Home Forums Sparkfun MP3 Shield Library Support Forum Does not work, Mega, mp3 and W5100 Ethernet

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3117
    Anonymous
    Inactive

    Hello, I am trying to make the system work, but is not responding.

    I have a Mega XDRduino 2560, Vs1053 Mp3 shield, and W5100 ethernet shield.

    In my Sd card, I have files with extension 053, bat and pl. If I use a simple example, the music plays, but not in my program.

    I also tried the example Webplayer native and does not work when I access the page by the browser, and I play, nothing happens.

     

    I believe it is a problem of conflict SPI.

    Called as the pinout:

    Mega 51’s to the MP3’s for D11 MOSI

    Mega 50’s to the MP3’s D12 for MISO

    Mega 52’s to the MP3’s for D13 SCK

    (photo).

     

    The command over the network works, because I view the Serial, and have even called a led by him.

    Can anyone help me?

    The code I used below:

    #include <SPI.h>

    #include <SdFat.h>

    #include <SdFatUtil.h> 

    #include <SFEMP3Shield.h>

    #include <Ethernet.h>

     

    SdFat sd;

    SFEMP3Shield MP3player;

    byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

    IPAddress ip(10,0,0,15);

    int max_linha = 80 ;

    String dados_de_entrada = String(max_linha) ;

     

    EthernetServer server(80);

    void setup() {

     

    Serial.begin(9600);

    //pinMode(10, OUTPUT);

    //digitalWrite(10, HIGH);

    //start the shield

    sd.begin(SD_SEL, SPI_HALF_SPEED);

    MP3player.begin();

    Ethernet.begin(mac, ip);

    server.begin();

    }

     

    //do something else now

    void loop() {

    EthernetClient client = server.available();

    if (client) {

    boolean current_line_is_blank = true;

    dados_de_entrada=”” ;

    while (client.connected()) {

    if (client.available()) {

    char c = client.read();

    if(dados_de_entrada.length() < max_linha) {

    dados_de_entrada.concat(c) ;

    }

    //if the character is an “end of line” the whole message is recieved

    if (c == ‘\n’) {

    Serial.println(dados_de_entrada);

    if(dados_de_entrada.startsWith(“1″,10)){

    MP3player.playTrack(1);

    break;

    }

    current_line_is_blank = true;

    dados_de_entrada=””;

    }

    else if (c != ‘\r’) {

    current_line_is_blank = false;

    }

    }

    }

    }

    // give the Client time to receive the data

    delay(1);

    client.stop();

    }

    #3118

    key points that may be issue. I suspect you have multiple problems:

    1) You need to ensure you are only using ONE of the SdCards, between the SFEMP3 shield and the EtherNet Shield.

    2) The EtherNet Shield does not support Interrupts. and in fact is broken when they are enabled. Note the following in the webplayer.ino example:

     * \warning
    * Need to set the following in the SFEMP3ShieldConfig.h, in order to work.
    * \code #define USE_MP3_REFILL_MEANS USE_MP3_Polled \endcode
    * as the Ethernet library makes interrupts not possible.

    along with the following in the loop()

    void loop()
    {

      MP3player.available();

     

    3) not sure what type of packet or how you are sending a packet that starts with “1”. most packets such as Telnet have a header. You may be able to get a way with NetCat.

    4) requires the socket connection to be broken between the sending of commands, as to clear the buffer, as not to simply append forever.

    note photo’s won’t attach in this forum.

    #3119
    Anonymous
    Inactive

     

    Well, to disable the ethernet shield sd, I suppose “digitalWrite (4, HIGH)”, tried but did not work.

     

    My program is done in android, the command that is equivalent to Arduino receives a message, where the character “1” is the index (10) of the String.

     

    Strange thing is that if I put the “MP3player.playTrack (1);” function in void setup () {}, the music plays, but about 6-7 seconds just hangs.

     

    I found fragmentations in forums other problems, mentioning where you have to disable the SPI ethernet shield using commands like digitalWrite (10, HIGH); tried that too, but has errors.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.