Arduino vs trinket Serial transmission problems

Afternoon,

I'm having trouble with doing serial transmission on an Adafruit 5v trinket. The maddening part is that I know I got it working on a previous project and am using the same code and am 90% sure I have the board wired the same, but cannot get it to work regardless of what I try.

I am trying to communicate with a "ANGEEK YX5300 UART Control Serial MP3 Music Player Module" and if I use a standard Arduino Uno with the following code it works perfectly, but it doesn't with the Trinket (note I don't bother connecting the Rx pin from the uno/trinket (pin 2) to the Tx pin on the MP3 player as I'm not needing responses from the MP3 player).

Using my multimeter I can see that both are transmitting something to the Rx pin on the MP3 player board, but without an oscilloscope I can't tell if it's a speed/timing issue or a voltage level issue.

Any advice on what I am doing wrong or an alternative approach for cheap and compact MP3 playing would be greatly appreciated, cheers.

#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 1

// Create a software serial object for the connection to the MP3 module
SoftwareSerial mp3 = SoftwareSerial( rxPin, txPin );

void setup() {
  mp3.begin(9600);
  pinMode(1, OUTPUT);
}

void loop() {
    //7E FF 06 0F 00 01 01 EF (play song 001.mp3)
    mp3.write(126);
    mp3.write(255);
    mp3.write(6);
    mp3.write(15);
    mp3.write((byte)0);
    mp3.write(1);
    mp3.write(1);
    mp3.write(239);
    delay(5000);
}

If you have this 5V Trinket, make sure you have the software clock frequency set to agree with the Arduino boards definition value, or the Baud rate will be wrong.

jremington:
If you have this 5V Trinket, make sure you have the software clock frequency set to agree with the Arduino boards definition value, or the Baud rate will be wrong.

Yep, that was exactly my issue. I think the first trinkets I got must have been 16MHz cause that's the board I had selected in the IDE, but switching to "trinket 8MHz" fixed the issue. Thanks a bunch! :slight_smile: