I am trying to get an Adafruit VS1053 Codec + MicroSD Breakout - MP3/WAV/MIDI/OGG Play + Record - v4 running on a Photon 2. I have a working setup with a Photon but have so far no luck with the Photon 2. As far as I can tell it is hanging at the line
Adafruit_VS1053_FilePlayer musicPlayer(MP3_RESET, MP3_CS, MP3_DCS, DREQ, SD_CS);
This is the pin hookup comparison between the two:
Player Photon Photon2
XDCS D5 ` D5
SDCS D2 D2
CS D3 D3
RESET D1 D1
SCLK A3 SK (SCK)
MOSI A5 S0 (MO)
MISO A4 S1 (M1)
GND Rail GND Rail GND
3V3 NC NC
VCC NC Rail 3.3
DREQ D4 D4
GND Rail GND Rail GND
AGND AJ GND AJ GND
LOUT AJ LEFT AJ LEFT
ROUT AJ RIGHTAJ RIGHT
// These are the pins used for the music maker FeatherWing
const int MP3_RESET = D1;// VS1053 reset pin (unused!)
const int SD_CS = D2;// SD Card chip select pin
const int MP3_CS = D3; // VS1053 chip select pin (output)
const int DREQ = D4; // VS1053 Data request, ideally an Interrupt pin
const int MP3_DCS = D5; // VS1053 Data/command select pin (output)
If there is anything that is obviously wrong I'd appreciate a comment. I assumed that the MP3 player needs to be powered by 3.3v so as to protect the SPI pins, so I connected the 3.3V pin on the Photon 2 to the VCC on the MP3 Player. I used the same SdFat as I used with the Photon setup which is 1.0.15. Also the flash is problematic in that I have to put it into DFU mode manually.
I was able to initialize the SPI connection to the VS1053 from the Photon 2. I used the FeatherWing variation, and probably an earlier version, but the initialization and the SD card worked.
t VS1053 Library Test
0000002342 [app] INFO: VS1053 found
files/
000001.txt
000003.txt
Of note:
Tested with Device OS 5.8.2
Adafruit Music Maker FeatherWing w/ Amp - MP3 OGG WAV MIDI Synth Player - Stereo 3W Amplifier (3436)
Used the Adafruit_VS1053 library
VS1053 initialized but I didn't test the audio features
SdFat worked correctly read the SD card
Copied the source from the ParticleTest example
The example source lists the pins that it uses
Added this to the top of setup to get more log messages:
Hello Rick,
Thank you for the suggestions. I ran the Photon setup and found my Adafruit_VS1053.cpp code sets the irq to _dreq whose value is 4. At that point I began to wonder if I had whacked my Photon 2 by allowing the mp3 player to be supplied with USB 5V. So I set up an new Photon 2 and then substituted that in. I am now at the point it at least says SD failed, or not present. The setup is: #define VS1053_DATA_SPI_SETTING SPISettings(8000000, MSBFIRST, SPI_MODE0)
if (!SD.begin(SD_CS, SD_SPI_SETTING ))
{
Serial.println("SD failed, or not present");
while(1) yield(); // don't do anything more
}
Serial.println("SD OK!");
I have double checked all the wiring and at this point the last thing to do is to upgrade the device OS from 5.8.0 to 5.8.2. I'll do that as soon as I figure out how to get it into my list of OS options.
Hi Rick,
I have downloaded the 5.8.2 device OS bin files: bootloader.bin
prebootloader-part1.bin
system-part1.bin
tinker.bin
I can't seem to find any instructions about loading them into VS Code and the toolchains. Is there a link to documentation that I failed to locate? Hopefully with the order of loading? The listing under BUGFIXES sort of caught my eye: * [RTL872x] multiple SPI fixes [#2768]
Upon further investigation I found the "particle.enablePre-releaseDeviceOSBuilds" setting in Workbench Core. It shows it as being false and I can't find out where to change it. Indeed it is under the "Welcome to Particle Workbench" screen. Set it to true, compiled and flashed with 5.8.2. Results??? It works perfectly! Thank you so much Rick! Your help saved me from more days of frustration and perhaps giving up!
Thank You,
Bob