Go Down

Topic: Issues using VS1053 library with Music Maker Feather wing (Read 171 times) previous topic - next topic

marsthrax

I'm using the Music Maker Feather Wing (https://www.adafruit.com/product/3436) in conjunction with a Bluefeather NRF52 (https://www.adafruit.com/product/3406). I am doing a lot of asynchronous music playing, and if certain events occur (button presses/character on serial line, whatever), I stop the current playback to change the track. The code I am using to stop current playback and switch to the new track looks like this:

Code: [Select]

void startPlayingFile(char* file) {
  if (music_available) { //music_available is a boolean I have set depending on whether the VS1053 is detected...so I can do testing without the wing attached.
    if (! musicPlayer.stopped()) {
      Serial.println("Stopping");
      musicPlayer.stopPlaying();
      while(!musicPlayer.stopped()) {
        Serial.println("Delaying...");
        delay(1);
      }
    }
    Serial.print("Playing ");
    Serial.println(file);
    musicPlayer.startPlayingFile(file);
  }
}


Often times it works, but sometimes calling `musicPlayer.stopPlaying()` causes all execution to halt. Any idea with that might be, or an appropriate way to switch playback mid-stream?

Grumpy_Mike

Try this:-
Take the XDCS pin from the chip, this is brought out to pin 22 on the Feather Wing board, and connect it to 3V3 through a 100K resistor.

I had a similar problem in that the chip would sometimes not work until I invented this fix.

marsthrax

Thanks for the idea. If I understand correctly, I am connecting the XDCS pin from the wing to 3V3 (through a 100K resistor). When I did that, the wing stopped working altogether. Did I miss something in your description? Are you suggesting instead that this more like a pull up resistor for a switch?

I'm no expert, but if I understand the suggestion correctly, this basically keeps the XDCS pin pulled high all the time...wouldn't that mean the device would never know it should listen for commands from the feather (since it is normally active low)?

Grumpy_Mike

Ah I was using the VS1053 in the MIDI input mode. Try pulling it down to Gnd instead of 3V3.

marsthrax

Gotcha, makes sense. I'm using it to read files from the SD card. Unfortunately, I've tried the following without luck:

1) Keep XDCS connected to pin 11, use pull-up resistor (100k to 3V3)
2) Keep XDCS connected to pin 11, use pull-down resistor (100k to GND)
3) Connect XDCS directly to 3V3
4) Connect XDCS directly to GND

The first two let it continue working in general, but did not solve the problem of randomly causing all execution to halt. The last two did not work at all, which I think makes sense. #3 would cause it to never see any commands, #4 would cause it to read all commands over SPI, which means it would mistakenly process commands meant for the SD card that is also on the wing. At least, that's my understanding of how this works (I haven't done much with hardware before, and this is my first Arduino project).

I guess the question is, if it is a problem of floating values, are there other lines that could/should be pulled up/down? Or, is there a way to regain control after the program basically stops running?


Grumpy_Mike

I agree with your analysis - not a phrase I use every day here  ;) 
Quote
I guess the question is, if it is a problem of floating values, are there other lines that could/should be pulled up/down? Or, is there a way to regain control after the program basically stops running?
Good question. It is probably worth asking on the AdaFruit forum as my only experance of this chip is getting it to run in the stand alone mode MIDI mode and it looks like all other pins are right for that.
Sorry I could not be of more help.

marsthrax

No worries, thanks for the thoughts/ideas. I definitely appreciated it! I'll ask on the AdaFruit forum and see if anyone has any ideas.

Go Up