ESP-IDF + DFPlayer = DFPlayerError:Get Wrong Stack

Checky
Posts: 4
Joined: Sun Oct 29, 2023 4:13 pm

ESP-IDF + DFPlayer = DFPlayerError:Get Wrong Stack

Postby Checky » Sun Oct 29, 2023 4:33 pm

Hello and good day,
I have the following problem that I'm struggling with.

I use an ESP-WROVER-KIT 4.1 in vscode and esp-idf.

As a test, I created 2 tasks with FreeRTOS. One of them should control my DFPlayerMini module.

For this I use this library -> https://github.com/nopnop2002/esp-idf-DFPlayerMini.

The module is connected to GPIO19 (TXD0) and GPIO25 (RXD0).

The serial baud rate is set to 115200 (even though I know that the player needs 9600) but when I set the baud rate to 9600 all I get is gibberish about the terminal and in the example as far as I can see the baud rate is not that important either placed. The output otherwise looks good and the serial communication seems to be working, at least basically... but I can't get a file to play.

The SD card is formatted correctly and previously worked in arduino and platformIO.

The player is initialized and also outputs status messages.

Code:

Code: Select all

#include <stdio.h>

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "esp_log.h"

#include "driver/uart.h"
#include <inttypes.h>
#include "DFRobotDFPlayerMini.h"


#define TAG "MAIN"


void task_LED1(void *param);
void task_LED2(void *param);


void app_main(void)
{
    
    xTaskCreate(task_LED1, "task1", 1024*8, NULL, 3, NULL);
    xTaskCreate(task_LED2, "task2", 1024*2, NULL, 3, NULL);
}


// task1 LED1
void task_LED1(void *param)
{

    while(1)
    {
        while(1) {
		bool ret = DF_begin(CONFIG_TX_GPIO, CONFIG_RX_GPIO, true);
		ESP_LOGI(TAG, "DF_begin=%d", ret);
		if (ret) break;
		vTaskDelay(200);
	}
	ESP_LOGI(TAG, "DFPlayer Mini online.");
	DF_volume(15); //Set volume value. From 0 to 30
    ESP_LOGI(TAG, "Play first track in mp3 folder.");
	DF_playMp3Folder(1); //Play the first mp3



    /*
    Wait until play finish.
    For some reason, when the play finished, Play Finished event is notified twice.
    I don't know why.

    received:7E FF 6 3D 0 0 1 FE BD EF
    Number:1 Play Finished!
    received:7E FF 6 3D 0 0 1 FE BD EF
    Number:1 Play Finished!
    */

	while(1) {
		if (DF_available()) {
			uint8_t type = DF_readType();
			int value = DF_read();
			//Print the detail message from DFPlayer to handle different errors and states.
			DF_printDetail(type, value);
		}
		vTaskDelay(1);
	}
    }
    vTaskDelete(NULL);
}

// task2 LED2
void task_LED2(void *param)
{

    while(1)
    {
        printf("Das ist Task2\n");
        vTaskDelay(1000);
    }
    vTaskDelete(NULL);
}
OUTPUT :

rst:0x1 (POWERON_RESET),boot:0x1e (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7080
load:0x40078000,len:15584
load:0x40080400,len:4
0x40080400: _init at ??:?

ho 8 tail 4 room 4
load:0x40080404,len:3876
entry 0x4008064c
I (31) boot: ESP-IDF v5.1.1 2nd stage bootloader
I (31) boot: compile time Oct 29 2023 13:57:35
I (31) boot: Multicore bootloader
I (35) boot: chip revision: v3.0
I (39) boot.esp32: SPI Speed : 40MHz
I (44) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 2MB
I (53) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (77) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (84) boot: 2 factory factory app 00 00 00010000 00100000
I (92) boot: End of partition table
I (96) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0a948h ( 43336) map
I (120) esp_image: segment 1: paddr=0001a970 vaddr=3ffb0000 size=02168h ( 8552) load
I (124) esp_image: segment 2: paddr=0001cae0 vaddr=40080000 size=03538h ( 13624) load
I (131) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=171e4h ( 94692) map
I (168) esp_image: segment 4: paddr=0003720c vaddr=40083538 size=09988h ( 39304) load
I (191) boot: Loaded app from partition at offset 0x10000
I (192) boot: Disabling RNG early entropy source...
I (203) cpu_start: Multicore app
I (203) cpu_start: Pro cpu up.
I (203) cpu_start: Starting app cpu, entry point is 0x400811d8
0x400811d8: call_start_cpu1 at C:/Users/CheckMakRack/esp/esp-idf/components/esp_system/port/cpu_start.c:154

I (0) cpu_start: App cpu up.
I (221) cpu_start: Pro cpu start user code
I (221) cpu_start: cpu freq: 160000000 Hz
I (221) cpu_start: Application information:
I (226) cpu_start: Project name: BTTF-TCD
I (231) cpu_start: App version: 1
I (236) cpu_start: Compile time: Oct 29 2023 14:00:14
I (242) cpu_start: ELF file SHA256: 214b27d5af081e4a...
I (248) cpu_start: ESP-IDF: v5.1.1
I (252) cpu_start: Min chip rev: v0.0
I (257) cpu_start: Max chip rev: v3.99
I (262) cpu_start: Chip rev: v3.0
I (267) heap_init: Initializing. RAM available for dynamic allocation:
I (274) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (280) heap_init: At 3FFB3208 len 0002CDF8 (179 KiB): DRAM
I (286) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (293) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (299) heap_init: At 4008CEC0 len 00013140 (76 KiB): IRAM
I (307) spi_flash: detected chip: generic
I (310) spi_flash: flash io: dio
W (314) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (328) app_start: Starting scheduler on CPU0
I (332) app_start: Starting scheduler on CPU1
I (332) main_task: Started on CPU0
I (342) main_task: Calling app_main()
I (342) uart_rx_task: Start
I (342) uart_tx_task: Start
Das ist Task2
I (352) main_task: Returned from app_main()

sending:7e ff 6 c 0 0 0 fe ef ef
received:7e ff 6 3f 0 0 2 fe ba ef
I (1482) MAIN: DF_begin=1
I (1482) MAIN: DFPlayer Mini online.

sending:7e ff 6 6 0 0 f fe e6 ef
I (1482) MAIN: Play first track in mp3 folder.

sending:7e ff 6 12 0 0 1 fe e8 ef
received:7e ff 6 40 0 0 3 fe b8 ef
DFPlayerError:Get Wrong Stack
Das ist Task2
received:7e ff 6 3b 0 0 2 fe be ef
Card Removed!
received:7e ff 6 3a 0 0 2 fe bf ef
Card Inserted!
Das ist Task2


I hope someone can help me, I would be happy to provide more information.

best regards Alex

I managed get some files played but it still don't work well.. but it tells me the baudrate is ok.. i think the error is coming up because the commands are to frequent fo the player.. so i will try to impliment a function that waits until the player is finished .. its all very testing .. to be able a stable use of the device and it is not my final purpose for it..

nopnop2002
Posts: 51
Joined: Thu Oct 03, 2019 10:52 pm

Re: ESP-IDF + DFPlayer = DFPlayerError:Get Wrong Stack

Postby nopnop2002 » Thu May 23, 2024 5:04 am

There are many variations of the MP3 IC installed in DF Player.

I own three DF Players, two are JC AA18 and one is YX5200.

YX5200 give me this error:

Code: Select all

sending:7e ff 6 3 0 0 1 fe f7 ef
received:7e ff 6 40 0 0 4 fe b7 ef
DFPlayerError:Check Sum Not Match

In addition to this, there are YM5200, YM5300, MH2024K, GD3200B, etc.
There is an article about Wrong Stack here.


https://github.com/arendst/Tasmota/discussions/11737



This issue can occur with certain MP3 ICs.
Attachments
IMG_5414.JPG
IMG_5414.JPG (219.75 KiB) Viewed 783 times

Who is online

Users browsing this forum: Baidu [Spider] and 212 guests