MP3-TF-16p and Serial 1, 2 or 3

Good afternoon. I'm trying to work with an MP3 player (mp3-tf-16p). I have an Arduino Mega. The sketch uses SoftwareSerial on pins 10 and 11. Everything works on these pins, as well as on other digital pins from 2 to 13. But, I have TFT enabled on these digital pins. I want to transfer MP3 to another Serial. Arduino Mega has 3 more of them: Serial 1, 2 and 3. Why doesn't it work on them. The first working sketch, my second one is not working. What am I doing wrong?

That's how it works

#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

void setup()
{
  mySoftwareSerial.begin(9600);
  Serial.begin(115200);
  Serial.println();
  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
  
  if (!myDFPlayer.begin(mySoftwareSerial)) {  
    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."));

That's how it works

#include "Arduino.h"
#include "DFRobotDFPlayerMini.h"

DFRobotDFPlayerMini myDFPlayer;

void setup()
{
  Serial3.begin(9600);
  Serial.begin(115200);
  
  Serial.println();
  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
  if (!myDFPlayer.begin(Serial3)) {  
    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."));
    

Which pins are you connecting the player to when running the sketch that does not work ?

Serial 3: TX -14, RX - 15.
Tried all three
Serial 2: TX -16, RX - 17.
Serial 1: TX -18, RX - 19.
By the way I tried mySoftwareSerial on pins from 22 to 40. It doesn't work either.

SoftwareSerial does not work on all pins on a Mega

See https://docs.arduino.cc/learn/built-in-libraries/software-serial

I am sorry to ask, but I assume that you have Tx/Rx cross connected properly

Sorry, while I tried different pins, I got confused myself that I need TX-RX, and RX-TX.

But about SoftwareSerial thanks. I didn't know.

Is your sketch working now with the Serial pins cross connected ?

yes, everything works. thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.