M4 GrandCentral and MusicMaker Shield (How to access SD)

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mikarmin
 
Posts: 19
Joined: Mon Oct 03, 2022 5:23 pm

M4 GrandCentral and MusicMaker Shield (How to access SD)

Post by mikarmin »

Hello, I started with an original Arduino Uno Rev3, small OLED 128x64 display and a MusicMakerShield. The display and the musicmaker shield cannot coexist due to lack of RAM (solved by Adadruit_Bill earlier). So, I upgraded to the only M4 available (Grand Central). I have loaded the UF2 to be compatible with IDE and loaded the VS1053 sample code as well as put on the CircuitPython UF2 and loaded the example code in the latest V7.x library. Both times the code is failing trying to read from the SD card. I have tried to tinker with assigning other port numbers to various unused pins without success. Since the GrandCentral has its own SD slot, not sure how I can designate to use the musicmaker boards slot and/or force the musicmaker to read from the GrandCentral's card. Can someone take the player simple example skectch and make work using a GrandCentral and post as an example? Thanks.

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: M4 GrandCentral and MusicMaker Shield (How to access SD)

Post by dastels »

I have loaded the UF2 to be compatible with IDE
The bootloader?

You mentioned CircuitPython. There's this
NOTE: This is not currently working for audio playback of files. Only sine wave test currently works. The problem is that pure Python code is currently too slow to keep up with feeding data to the VS1053 fast enough. There's no interrupt support so Python code has to monitor the DREQ line and provide a small buffer of data when ready, but the overhead of the interpreter means we can't keep up. Optimizing SPI to use DMA transfers could help but ultimately an interrupt-based approach is likely what can make this work better (or C functions built in to custom builds that monitor the DREQ line and feed a buffer of data).
So CircuitPython seems to be a deadend for playing audio files.

So, C++. About the SDCard slots, see https://learn.adafruit.com/adafruit-gra ... rd-3015149.

In C++/Arduino you should be ok using the card slot on the GrandCentral. The VS1053 library makes use of the SD library so according to the link above, it sounds like you're stuck with the GrandCentral's SD slot.

Dave

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: M4 GrandCentral and MusicMaker Shield (How to access SD)

Post by mikeysklar »

We can help you get the Music Maker going with the Grand Central.

The SD card for the Grand Central is on a separate SPI bus.

The music maker shield supports 3v3 which is something that has changed when you went to the M4 Grand Central so that should also be a non-issue.

Are you starting with the simple player example?

https://github.com/adafruit/Adafruit_VS ... simple.ino

I believe the Grand Central has MISO / SCK / MOSI pins like the Mega boards. Did you solder the MISO/SCK/MOSI ISP headers.

https://learn.adafruit.com/adafruit-mus ... rs-1214285

https://learn.adafruit.com/adafruit-mus ... ega-679331

User avatar
mikarmin
 
Posts: 19
Joined: Mon Oct 03, 2022 5:23 pm

Re: M4 GrandCentral and MusicMaker Shield (How to access SD)

Post by mikarmin »

Hello,

I think we are getting to the issue with the SPI bus. To answer your questions. Yes, I am using the simple player example. However, the simple player example states to uncomment and use the second declaration for the VS1053 that does not reference the MISO pins of the SPI. When you use this declaration on the UNO R3 the sketch works:

Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(MP3_RESET, MP3_CS, MP3_DCS, DREQ, SD_CS);

When attached to the GrandCentral M4 using this declaration but changing the SD card select pin to the one mentioned for the onboard SD Card would result in the following:

Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(MP3_RESET, MP3_CS, MP3_DCS, DREQ, SDCARD_SS_PIN);

But still no output. This declaration does not inlcude SPI information.

Additionally, the Serial.print() statements do not result in the serial monitor in the Arduino IDE updating so I am running blind at the moment. I would like to avoid soldering the pads to use the SPI port and instead let them eat up a Digital I/O pin to keep it compatible with my UNO.

Will keep playing around.

User avatar
mikarmin
 
Posts: 19
Joined: Mon Oct 03, 2022 5:23 pm

Re: M4 GrandCentral and MusicMaker Shield (How to access SD)

Post by mikarmin »

I used hardware jumpers to attach the digital pins to the SPI bus connector (MISO, MOSI, SCK) and sure enough the sketch worked.

However, still have no Serial output to the serial monitor so would appreciate if you could assist in debugging this. Thanks

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: M4 GrandCentral and MusicMaker Shield (How to access SD)

Post by dastels »

I linked to the relevant information, but I'll include it here:
We've included a micro SD card slot on this board!

This is also on a separate SPI port, so it doesn't collide with the SPI header/port used for other devices. In Arduino this is called SPI1 and by default, the SD library will know to use this for SD card interfacing. So, if you have a shield with an SD card slot, you won't be able to use that SD card connection! The library will always use the onboard SD card socket instead.
Dave

User avatar
mikarmin
 
Posts: 19
Joined: Mon Oct 03, 2022 5:23 pm

Re: M4 GrandCentral and MusicMaker Shield (How to access SD)

Post by mikarmin »

All,

This was a hardware ignorance on my side. Once I jumpered the digital pins to the SPI pins, music was present. Serial data was not present as the code never got past default begin() statements. Once I loaded the code and kept it attached with all hardware connected, I achieved full functionality. Thanks for the links to the M4 hardware info on the SD card select declaration as well as the VS1053 page to remember to hook up the SPI ports when using different boards (UNO vs M4 grand central). Thanks all for the input

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

Return to “Metro, Metro Express, and Grand Central Boards”