A big problem with serial communication

For me, the serial communication breaks off at a point in the program and I don’t know what to do next… I have to find a way to debug my project… without serial communication I don’t know how it works… or I need tips from experienced programmers … as far as I’m concerned, a hardware solution has to be found … but I would like to send you the code snippets … maybe you’ll know more spontaneously.

main.cpp :

//INITIALISIERUNGSDEKLARATIONEN//////////////////////////////////////////////////////////////////////////////////////////////////

#define DEBUG_BAUD_RATE			115200      // Serielle Kommunikation 
#define SERIAL_BUFFER_SIZE  256       // Puffergröße für Serielle kommunikation erhöhen

//###############################################################################################################################

//SETUP///INITIALISIERUNG////////////////////////////////////////////////////////////////////////////////////////////////////////

void setup() {

  Serial.begin(DEBUG_BAUD_RATE);               //Serielle Ausgabe 
  

DFPlayer.cpp :

#include "DFPlayer.h"

//###############################################################################################################################

DFRobotDFPlayerMini myDFPlayer;                 // Objekt der DFRobotDFPlayerMini-Klasse
/////////////////////////////////DFPLAYER////////////////////////////////////////////////////////////////////////////////////////

// Initialisierungsfunktion
void DFPlayer_Init() {

   
  FPSerial.begin(9600, SERIAL_8N1, /*rx =*/RX, /*tx =*/TX);
  
  
  Serial.println(F("Initializing DFPlayer"));                         //DFPLAYER initialisierung  
 if (!myDFPlayer.begin(FPSerial, /*isACK = */true, /*doReset = */true)) {  //Use serial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    while(true);
  }
  Serial.println(F("DFPlayer Mini online."));


  myDFPlayer.setTimeOut(500); //Set serial communictaion time out 500ms  

  myDFPlayer.volume(12);                                              //Set volume value (0~30).
}

DFPlayer.h :

//INITIALISIERUNGSDEKLARATIONEN//DFPLAYER////////////////////////////////////////////////////////////////////////////////////////
#define ESP32                                         // Arbeiten mit ESP32
#define RX (16)                                       // PIN 16 
#define TX (17)                                       // PIN 17
#define FPSerial Serial1

extern DFRobotDFPlayerMini myDFPlayer;              // Deklaration externe Objekt-Klasse

void printDetail(uint8_t type, int value);            // Ausgabe des DFP
void DFPlayer_Init();                                 // Initialisierungsfunktion

//###############################################################################################################################
#endif   

There is also a RTC … all modules function fine but my serial output breaks at this point…

---- Opened the serial port COM6 ----
ets@Jul`29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (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:1184
load:0x40078000,len:13192
load:0x40080400,len:3028
entry 0x400805e4
Initializing DFPlayer
DFPl

After each Serial.println(), place a Serial.flush() so that the output is fully. You will know where it stopped printing better.

This is name is way too generic and already in use as a variable in the Arduino-ESP32 core with a different value.

Try renaming these config macros to like DFPLAYER_SERIAL_RX etc.

ok thank you for you reply`s first

serial.flush(); brought me a little further :slight_smile: I also adopted the changes that you suggested but I don’t get much more output… normally the RTC still has to report… and the rest of the output from the serial communication is not output either. But thank you very much, with every step you learn something new.

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xets Jul 29 2019 12:21:46

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (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:1184
load:0x40078000,len:13192
load:0x40080400,len:3028
entry 0x400805e4
Initializing DFPlayer
DFPlayer Mini online.

After I arranged the header files a little differently… I also got the output of the RTC…:
09/23/2023 08:49:13
RTC is newer than compile time, this is expected Initializing
DFPlayer DFPlayer Mini online.

BUT the error output from DFPlayer doesn’t work either.
Serial.println(F(“Initializing DFPlayer”)); //DFPLAYER initialization
if (!myDFPlayer.begin(FPSerial, /*isACK = */true, /*doReset = */true)) { //Use serial to communicate with mp3.
Serial.println(F(“Unable to begin:”)); Serial.println(F(“1.Please recheck the connection!”)); Serial.println(F(“2.Please insert the SD card!”)); while(true); }
Serial.println(F(“DFPlayer Mini online.”));
Serial.flush();

After that I no longer have any serial output.