VS1053 - Trouble getting examples to work

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
ramin-shami
 
Posts: 6
Joined: Tue Dec 10, 2013 4:30 pm

Re: VS1053 - Trouble getting examples to work

Post by ramin-shami »

adafruit_support_bill wrote:
Hi I have this EXACT same problem
Same advice then: Post photos showing your soldering and all your connections to the Arduino. Also, check the Serial Monitor output while you are running the sample code. If there are any SD card reading errors, they will be printed there.
I'm using a breadboard and double checked the connections and they are all fine.. Could the issue be the SD card if the test tone works?(musicPlayer.sineTest(0x45, 2000); // Make a tone to indicate VS1053 is working)

My code:

Code: Select all

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>

// define the pins used
#define CLK 13       // SPI Clock, shared with SD card
#define MISO 12      // Input data, from VS1053/SD card
#define MOSI 11      // Output data, to VS1053/SD card
// Connect CLK, MISO and MOSI to hardware SPI pins. 
// See http://arduino.cc/en/Reference/SPI "Connections"

// These can be any pins:
#define RESET 9      // VS1053 reset pin (output)
#define CS 10        // VS1053 chip select pin (output)
#define DCS 8        // VS1053 Data/command select pin (output)
#define CARDCS 4     // Card chip select pin
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin


//Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(RESET, CS, DCS, DREQ, CARDCS);
Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(MOSI, MISO, CLK, RESET, CS, DCS, DREQ, CARDCS);

void setup() {
  Serial.begin(9600);
  Serial.println("Adafruit VS1053 Simple Test");


  musicPlayer.begin(); // initialise the music player
  SD.begin(CARDCS);    // initialise the SD card
  
  
  musicPlayer.sineTest(0x45, 2000);    // Make a tone to indicate VS1053 is working
  
  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(20,20);

  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int
  
  // Play one file, don't return until complete
  musicPlayer.playFullFile("track001.mp3");
  // Play another file in the background, REQUIRES interrupts!
  musicPlayer.startPlayingFile("track002.mp3");
}

void loop() {
  // File is playing in the background
  if (! musicPlayer.playingMusic) 
    Serial.println("Done playing music");
  
  delay(1000);
}
Attachments
photo 1.JPG
photo 1.JPG (756.96 KiB) Viewed 1374 times
Last edited by adafruit_support_bill on Wed Dec 11, 2013 9:26 am, edited 1 time in total.
Reason: Please use the 'code' button when submitting code - click 'code' and paste your code between the tags.

User avatar
ramin-shami
 
Posts: 6
Joined: Tue Dec 10, 2013 4:30 pm

Re: VS1053 - Trouble getting examples to work

Post by ramin-shami »

adafruit_support_bill wrote:
Hi I have this EXACT same problem
Same advice then: Post photos showing your soldering and all your connections to the Arduino. Also, check the Serial Monitor output while you are running the sample code. If there are any SD card reading errors, they will be printed there.
Also, in the Serial Monitor I get no SD card errors, it only repeats "Done playing music"


Any ideas??
Thanks

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: VS1053 - Trouble getting examples to work

Post by adafruit_support_bill »

It looks like your headers on both the VS1053 and the amp are not soldered. You need to solder these for a reliable electrical connection.

User avatar
ramin-shami
 
Posts: 6
Joined: Tue Dec 10, 2013 4:30 pm

Re: VS1053 - Trouble getting examples to work

Post by ramin-shami »

adafruit_support_bill wrote:It looks like your headers on both the VS1053 and the amp are not soldered. You need to solder these for a reliable electrical connection.
I have triple checked the connections with a multimeter and they are all fine. I haven't soldered the connections because I will be embedding the boards in a fabric project later so I don't want headers attached. Like I said, the sine test works fine, so surely it is not a connectivity issue?
Any other suggestions?

Thanks

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: VS1053 - Trouble getting examples to work

Post by adafruit_support_bill »

I have triple checked the connections with a multimeter and they are all fine.
Most dodgy connections will conduct fine when you poke them with a meter probe.
the sine test works fine, so surely it is not a connectivity issue?
The sine test does not use all the same signal connections as when playing music. You need to solder all your connections or use something like a pogo-pin jig for reliable operation.
I will be embedding the boards in a fabric project later so I don't want headers attached.
At some point you need to solder leads to the board. So solder the leads on now and plug those into the breadboard.

User avatar
ramin-shami
 
Posts: 6
Joined: Tue Dec 10, 2013 4:30 pm

Re: VS1053 - Trouble getting examples to work

Post by ramin-shami »

ramin-shami wrote:At some point you need to solder leads to the board. So solder the leads on now and plug those into the breadboard.
Alright I will give this a shot and let you know.

User avatar
techiebot
 
Posts: 24
Joined: Tue Sep 01, 2009 10:00 pm

Re: VS1053 - Trouble getting examples to work

Post by techiebot »

I had my VS 1053 board working just fine with an Arduino Mega. But now, after I mounted it on a board with spacers, it is playing the sound files as if it is in fast, garbled speed. I have looked over the connections and can't see anything that shifted. I double-checked that the pins are connected to the Arduino correcly. I do get the message that the SC card is OK. But the files play all wrong.

Any ideas?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: VS1053 - Trouble getting examples to work

Post by adafruit_support_mike »

Post a photo of your setup and we'll see what we can find.

vlsipanu
 
Posts: 1
Joined: Fri Dec 20, 2013 6:19 pm

Re: VS1053 - Trouble getting examples to work

Post by vlsipanu »

Hi!
it is playing the sound files as if it is in fast, garbled speed.
Fast, garbled means the electrical data connection is shaky and there are bit errors in the (mp3) data. VS1053 will skip bad blocks and advance to the next (mp3) block as fast as it can - that's why it's faster. It's garbled because 1) some sound blocks are missing and 2) the (bit reservoir) state of the decoder is incorrect which leads to extra chirps of various frequencies in these error conditions.

The solution is usually to check that your ground connections are strong, then check that your IO voltage is smooth and usually at about 3 volts. If these are all correct, check that the digital data connections are ok and that no other chips are pushing or pulling the data lines. If you have an oscilloscope, you should see clear signals with two clearly defined levels: high and low. If there are any strange looking signals that are in the middle between high and low, that may indicate that different chips are both driving a data line at the same time or that there is a short circuit. If you're controlling the SPI data transfer yourself, the problem may also be wrong clock phase/polarity setting of the microcontroller's SPI hardware. If the same SPI bus is shared between more chips than the microcontroller and the VS1053 (for example the microcontroller, VS1053 and the SD card all use the same bus) then it may be a problem with the timing of chip selects (more than one chip select active at the same time).

-Panu

syonker
 
Posts: 12
Joined: Tue Mar 04, 2014 9:24 am

Re: VS1053 - Trouble getting examples to work

Post by syonker »

I'm at a total loss. I have rewired, revalidated solder points. Using a card that has worked with this board, with this Mega 2560 in the past.

Very simple sketch that tests a tone and tries to load and play "track001.mp3".

The only difference is that this time I have a Windows 8.1 box in charge of the file loads as opposed to Windows 7 the last time I had a run-in with this board. I'm stumped.

ENVIRONMENT:
1) Mega 2560 Board.
2) Version 2 of VS1053B breakout.
3) FAT-16 formatted Micro SD card.
4) These three have worked together flawlessly before.
5) MP3 files on SD card are "track001.mp3" and "track002.mp3" respectively. These very files have worked in the past.

TESTS:
1) Tried both FAT16 and FAT32 formatting - no difference.
2) Inspected all solder joints with a magnifying glass - all are good.
3) Metered all connections by PIN as they pertain to Mega 2560, and all are showing solid continuity.
4) Tried "play_simple" sketch and variations of it - no dice.
5) Inserted a sineWave() method and that *did* sound off.
6) Caught the return from the "SD.begin(CARDCS)" and it's failing.
7) Changed wiring, re-metered all - still good. No change - still fails the SD.begin(CARDCS) call.
8) Made sure MISO, MOSI and (on this board) SCLK go to Mega 2560 pins 50, 51 and 52 respectively. They do...no change.

I'm running out of ideas. Any assistance or other troubleshooting ideas that anybody can offer would be appreciated.

-S

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: VS1053 - Trouble getting examples to work

Post by adafruit_support_bill »

Run the cardinfo example sketch from the SD library. Make sure you select the right CS pin.

If you post photo showing all your soldering and connections, we'll take a look.

syonker
 
Posts: 12
Joined: Tue Mar 04, 2014 9:24 am

Re: VS1053 - Trouble getting examples to work

Post by syonker »

Hey, thanks for the quick response.

Ran it...negative results. It just comes up with the standard messages:

"Initializing SD card...initialization failed. Things to check:
* is a card is inserted?
* Is your wiring correct?
* did you change the chipSelect pin to match your shield or module?"

I *did* make sure to review the code for any changes I had to make it properly line up with my hardware, being the Mega 2560 instead of a standard Uno...

However, in doing so, something confusing surfaced: It claims that for a Mega 2560, the output pin *must* be 53...however, in the wiring diagram for the Adafruit VS1053 Breakout (in the on-line tutorial), it shows connecting the following pins (of which 53 isn't mentioned):

• CLK -> Arduino #13 (Mega 52)
• MISO -> Arduino #12 (Mega 50)
• MOSI -> Arduino #11 (Mega 51)
• CS -> Arduino #10
• RST -> Arduino #9
• XDCS-> Arduino #8
• SDCS -> Arduino #4
• DREQ -> Arduino #3


I am guessing that I'm missing something *really* obvious here, but my brain is fried at this point - so much work, so little time.

Thanks in advance for any information you can provide.

I attached a shot of my breadboard. It looks a little strange because of the shape of the board, My jumper wires were too short for single runs to the VS1053, so I had to use the breadboard to "lengthen" the wires...essentially necessitating twice as many wires as would normally be necessary. This was done to meet the needs of the project...I need it to fit in a cylinder wrapped with one of your other *amazing* products: NeoLights. That big capacitor and the resistor you see in there are to protect the NeoLights.

-S


Image

syonker
 
Posts: 12
Joined: Tue Mar 04, 2014 9:24 am

Re: VS1053 - Trouble getting examples to work

Post by syonker »

Hi Gang,

So as an effort to figure out what's going on, I totally undid the wiring, moved the VS1053 to a different spot on the bread board, and used entirely different jumper wires (see attached photo).

I tried all four permutations of the pin config (as I mentioned in my prior post...it's a little confusing as the test sketch by Tom mentions pin 53 as an output, but it's absent from the wiring diagram in the tutorial and hence not hooked up to anything, so I tried all possible connections there). I *did* set the CS pin in his sketch to 10 to match the Adafruit board ne mentions in the comments...still no joy.

Unfortunately, this is yielding the *exact* same results. Still can generate a tone - still fails the SD load from the SD test sketch, and/or any of the Adafruit example sketches. Hmmmm I *still* think it's something to do with my wiring on the Mega board...

My next attempt is going to be to hit the stores when the open for a different SD card (although I don't have a reason to think this one doesn't work - it loads fine on my computer and has worked in this board before).

Beyond that, I'm stumped.

-S


Image

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: VS1053 - Trouble getting examples to work

Post by adafruit_support_bill »

the output pin *must* be 53.
Pin 53 must be configured as an output (regardless of whether it is connected. I think it is due to some quirk of the library.

In the setup portion of your code try adding:

Code: Select all

pinMode(53, OUTPUT);
http://arduino.cc/en/Reference/SDbegin
Initializes the SD library and card. This begins use of the SPI bus (digital pins 11, 12, and 13 on most Arduino boards; 50, 51, and 52 on the Mega) and the chip select pin, which defaults to the hardware SS pin (pin 10 on most Arduino boards, 53 on the Mega). Note that even if you use a different chip select pin, the hardware SS pin must be kept as an output or the SD library functions will not work.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: VS1053 - Trouble getting examples to work

Post by adafruit_support_mike »

adafruit_support_bill wrote:Pin 53 must be configured as an output (regardless of whether it is connected. I think it is due to some quirk of the library.
I had to dig through the SPI library recently, so I know this one:

That pin is semi-hardcoded in the library. Technically the value they use is the constant 'SS', but that's assigned to a specific pin in one of the low-level header files.

The SPI library uses the state of pin SS to decide whether the Arduino should be an SPI master or an SPI slave. As long as SS is configured for OUTPUT, the Arduino is a master. If SS is ever set LOW then configured for INPUT, the Arduino will switch to SPI slave mode.

You can use the SS pin for any kind of output.. its HIGH/LOW state has no effect on the SPI library.. but it has to remain an OUTPUT.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”