mpflaga / Arduino_Library-vs1053_for_SdFat

Arduino device library interfacing vs1053 MP3 player chip to audio stream from an Sd Card.
https://mpflaga.github.io/Arduino_Library-vs1053_for_SdFat/
Other
38 stars 13 forks source link

Not working on ATmega2560 #19

Open Atlan4 opened 1 year ago

Atlan4 commented 1 year ago

Does anyone have a player on the ATmega2560 microprocessor, it doesn't want to work. Does anyone know what changes need to be made?

mpflaga commented 1 year ago

Have you looked at previous issues, and or the project support page. Below is my response to another person requesting similar assistance, just a few weeks back.

... I just tested a similar setup as shown in the photo 20230327_203422 and it worked as expected. I was able to show the directory and play an MP3 file.

I suspect you already know this. See THIS LINK FOR MEGA SPI Jumpers for the cabling shown in the above photo. ...

Atlan4 commented 1 year ago

Good day. I'm running out of ideas, why does it work on UNO and not on ATmega2560. I changed pin 2 to 21 because the atmega 2560 has INT0 on sck pin21 #define MP3_DREQ 21

I am attaching code that should work with sdfata 2.2.2. if I compile it for uno it works, if I compile it for atmega it doesn't work it reports error 2 (error 24 because I preferred to sort the error reports).

Can you imagine why it doesn't work? OpenNext_test_v2_lite.rar.zip

Are libraries necessary? and because I didn't have them installed until now and everything worked

mpflaga commented 1 year ago

Please note that Error Codes indicates Error 2 is a fail to detect SdCard. Hence, I think your problem may be with not using the Jumper on SPI port. As with my previous statement. _I suspect you already know this. See THIS LINK FOR MEGA SPI Jumpers for the cabling shown in the above photo.

Both the SdCard and vs1053 use the SPI bus as detailed in Arduino Mega Board

regarding TimerOne and SimpleTimer please see USE_MP3_REFILL_MEANS In short; this can specify a polling method other than IRQ's. When set to polling or IRQ's not used then it is the responsibility of the top INO file to poll. The demo.ino file has #IF's around examples that use this setting to determine if they are to be used. So hence by default the IRQ's are used and their includes are skipped.

If you change the DREQ you will need to customize the default line of vs1053_SdFat_config.h MP3_DREQ which is set to pin 2 by default. The value for most Shields on an UNO/Mega. The file will be in the library not the INO project folder.

Also please note that you will need to ensure that pin 2 does not interfere. The default of most pins are INPUT so you are most likely fine. Unless you change it elsewhere to OUTPUT. When it is an output and left connected it will mess with the wiring. Please refer to this YouTube for a similar Pin change.

I have just tested the demo.ini from the project with the one change to vs1053_SdFat_config.h line 47 from 2 to 21 and it works fine. And it fails when I pull the wire from 21. So I know it is really working.

Please note that __BIOFEEDBACK_MEGA__ is not the Arduino Mega 2650 Rev3. It is a customer Board. With the exception of the SPI, the pins are the same on the UNO and Mega.

As I mention, in the other issue request, this will take more work than I have available to re-work. I hope the above helps you get going.