Go Down

Topic: Elechouse MP3 shield makes Uno crash (Read 227 times) previous topic - next topic

waldur

Hi!

I'm using mentioned shield on Uno.
Communication is over HW serial.
3 different MP3's are played according to keys pressed and connected to inputs 10, 11, 12.
Blink_without_delay uses LED on 13, for debugging, to see, if the loop keeps running.

After day or two system crashes. All status-LEDs are ON, like the have to be, LED on 13 is OFF, and buttons does not work.

Commands are sent to the shield like they has to be.

Is there any ascpect I have to pay attention to?

At the moment each button forces MP3 shield to do this:

0xA4: Stop (to be sure previous track is stopped)
0xA7: set good volume
0xA9: configure playing mode
0xA0: select track

delay(700): play this track at this volume for some time.

0xA7: set new higher volume

delay(700): play this track at this volume for some time.

0xA7: set new higher volume

delay(700): play this track at this volume for some time.

0xA7: set new higher volume

delay(3000): play this track at this volume for some time.

And if this time passes, the track can play til the end, it does not start playing over and over again.

Code is like this:


   /////////////////
    cmd_buf[0] = 0x7E;          // START
    cmd_buf[1] = 0x02;          // Length
    cmd_buf[2] = 0xA4;          // Command SET MODE
    cmd_buf[3] = 0x7E;          // END
    ArduinoMP3Shield_SendCMD(cmd_buf, 4);
/////////////////
   
/////////////////
    cmd_buf[0] = 0x7E;          // START
    cmd_buf[1] = 0x03;          // Length
    cmd_buf[2] = 0xA7;          // Command
    cmd_buf[3] = 0x11;          // new volume 5
    cmd_buf[4] = 0x7E;          // END
    ArduinoMP3Shield_SendCMD(cmd_buf, 5);
/////////////////

/////////////////
    cmd_buf[0] = 0x7E;          // START
    cmd_buf[1] = 0x03;          // Length
    cmd_buf[2] = 0xA9;          // Command SET MODE
    cmd_buf[3] = 0x00;          // set mode   
    cmd_buf[4] = 0x7E;          // END
    ArduinoMP3Shield_SendCMD(cmd_buf, 5);
/////////////////

/////////////////
    cmd_buf[0] = 0x7E;          // START
    cmd_buf[1] = 0x04;          // Length
    cmd_buf[2] = 0xA0;          // Command For U Disk change this line to 0xA2
    cmd_buf[3] = 0x00;          // file number high byte
    cmd_buf[4] = 0x02;          // file number low byte     Actual track number
    cmd_buf[5] = 0x7E;          // END
    ArduinoMP3Shield_SendCMD(cmd_buf, 6);
/////////////////

delay(700);

/////////////////
    cmd_buf[0] = 0x7E;          // START
    cmd_buf[1] = 0x03;          // Length
    cmd_buf[2] = 0xA7;          // Command
    cmd_buf[3] = 0x14;          // new volume
    cmd_buf[4] = 0x7E;          // END
    ArduinoMP3Shield_SendCMD(cmd_buf, 5);
/////////////////

delay(700);

/////////////////
    cmd_buf[0] = 0x7E;          // START
    cmd_buf[1] = 0x03;          // Length
    cmd_buf[2] = 0xA7;          // Command
    cmd_buf[3] = 0x17;          // new volume 5
    cmd_buf[4] = 0x7E;          // END
    ArduinoMP3Shield_SendCMD(cmd_buf, 5);
/////////////////

delay(700);

/////////////////
    cmd_buf[0] = 0x7E;          // START
    cmd_buf[1] = 0x03;          // Length
    cmd_buf[2] = 0xA7;          // Command
    cmd_buf[3] = 0x19;          // new volume 5
    cmd_buf[4] = 0x7E;          // END
    ArduinoMP3Shield_SendCMD(cmd_buf, 5);
/////////////////

delay(700);

/////////////////
    cmd_buf[0] = 0x7E;          // START
    cmd_buf[1] = 0x03;          // Length
    cmd_buf[2] = 0xA7;          // Command
    cmd_buf[3] = 0x19;          // new volume 5

    cmd_buf[4] = 0x7E;          // END
    ArduinoMP3Shield_SendCMD(cmd_buf, 5);
/////////////////

delay(3000);



Question is that does it has to crash when I use it like this or is there something else?


Thank you for your time,

Heldur



borland

How do you have the bridge jumpers on the backside of the board?   The datasheet for that shield recommends using SoftwareSerial library with Arduino Uno digital pins 7 and 8.

waldur

Hi!

At the moment jumpers are set to use hw serial.
Have I read the datasheet badly? Indeed, using hw serial makes the upolading for a new sketch even harder (I have to remove the shield for this), but does the datasheet suggest to use sw-serial instead of hw?
If there might be some known issues with hw serial, then it is quite clear.
Would you suggest sw serial?
I have no "favourite" serial, actually :)  So I'm open to all, as long as I know why :)

borland

Yes, SoftwareSerial is quite easy to use.  You can easily program the software serial for the shield and still use the hardware serial for the Serial Monitor.  Great for debugging the program.

http://www.arduino.cc/en/Reference/SoftwareSerial

Go Up