ArduinoGeneral

Help with Non Arduino (Atom-Lite m5stack) and dfplayer

userHead Account cancelled 2021-02-21 12:40:57 607 Views1 Replies
IF this isn't the right place for help with the atom-lite then it would be great if someone could point me towards something. Hopefully you folk can still give me some pointers with the dfplayer

I've been trying to get these two to talk each other on and off for about a month now and having real issues even getting the dfplayer to make any sort of noise.

(i also have a second dfplayer as a spare if required)is there a way to get the dfplayer to play noise just on its own. And if when doing that it fails to do anything is that an issue with how ive set up my sd card?Sd card setup formatted with an mp3 folder and a file name 0001.mp3 inside

as foir connecting the two I was hoping to get any sort of messages so i could begin debugging whats wrong with the dfplayer but I get nothing. Ive connected the rx and tx to two of the atom-lites i/o ports and connected the dfplayers power to the atom lites 5v and ground out connector. (when removing and putting in the power for the dfplayer the speaker ive attached to the dfplayer does make a small sound as if power is getting through quickpayportal)
Code: Select all
#define MP3_RX_PIN  26 // Groveポート
#define MP3_TX_PIN  32  // Groveポート
#define SW_1_PIN    39
void setup(){
  M5.begin();
  

  Serial.begin(115200);
  Serial1.begin(9600, SERIAL_8N1, MP3_RX_PIN, MP3_TX_PIN);
  pinMode(SW_1_PIN,   INPUT_PULLUP);
  execute_CMD(0x3F, 0, 0);
  delay(50);
  while(Serial1.available()<10)
  {
    delay(100);
    Serial.println(Serial1.available());
  }
  for (byte k=0; k<10; k++)
 {
  Serial.write(Serial1.available());
 }
    
  execute_CMD(0x06, 0, 30);
  Serial.println("DID THE DO");
  delay(50);
  execute_CMD(0x11, 0, 1);
  delay(50);
        execute_CMD(0x0D,0,1);
        delay(5);
  Serial.println("tredO");
}
Code: Select all
void execute_CMD(byte CMD, byte Par1, byte Par2) // Excecute the command and parameters
{
 // Calculate the checksum (2 bytes)
 int16_t checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);

 // Build the command line
 byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge, Par1, Par2, checksum >> 8, checksum & 0xFF, End_Byte};

 //Send the command line to the module
 for (byte k=0; k<10; k++)
 {
  Serial1.write( Command_line[k]);
 }
}
This just stalls at the serial1.available();I also have a small bit of code that just says on and off when i press the provided button on the atom lite so i can prove the atom lite isn't fried.
2021-02-22 09:44:23 I still don’t know the specific situation, but I think you can check the hardware connection to see if the serial port is reversed, or if the serial port is occupied userHeadPic 347945801