SimpleSDAudio error 130 - what can be wrong?

Hello!
About a month ago I used a plenty of Arduino Uno boards for playing sounds using SimpleSDAudio. They all worked perfectly without any issues. Now I'm struggling for weeks to make a single board working properly. I tried three different Arduino Uno boards, and yet every single one isn't working, leaving the same error code: 130.
The SD card is working properly, checked with this code.
For playing the sound I'm using this code.
What else can be an issue? I can't find any more information about 130 error, and it's driving me crazy :frowning:

Error 130 (0x82) == SSDA_ERROR_NOT_INIT "System not initialized properly". It seems to happen when the data buffer pointer has not been set. That would happen if the creation of the data buffer fails.

Try the example sketch BareMinimumWithDebug. That will point out errors rather than ignoring them.

kamild1996:
What else can be an issue?

You don't use hardware "Slave Select" pin for your SD card.
But you use another pin.
And in addition, you don't set the hardware "Slave Select" pin to OUTPUT.

This combination can make your SPI device fail.

Better include a line to set hardware Slave Select pin to OUTPUT:

  pinMode(SS,OUTPUT);
  SdPlay.setSDCSPin(4);

Any changes?

kamild1996:
SSDA_MODE_FULLRATE

Does this mean you try to operate SPI at highest possible hardware SPI speed?
Hopefully, your SPI cables from controller to SD card are then less than 5 cm (2 inches)!

jurs:
You don't use hardware "Slave Select" pin for your SD card.
But you use another pin.
And in addition, you don't set the hardware "Slave Select" pin to OUTPUT.

This combination can make your SPI device fail.

Better include a line to set hardware Slave Select pin to OUTPUT:

  pinMode(SS,OUTPUT);

SdPlay.setSDCSPin(4);




Any changes?

Does this mean you try to operate SPI at highest possible hardware SPI speed?
Hopefully, your SPI cables from controller to SD card are then less than 5 cm (2 inches)!

Added the pinMode line but it didn't help.
The wires are about 10 cm long, exactly how I did that with those other boards I mentioned (which are still working).

johnwasser:
Error 130 (0x82) == SSDA_ERROR_NOT_INIT "System not initialized properly". It seems to happen when the data buffer pointer has not been set. That would happen if the creation of the data buffer fails.

Try the example sketch BareMinimumWithDebug. That will point out errors rather than ignoring them.

Ok, that's interesting. My code kept throwing the 130 error. When I uploaded the BareMinimumWithDebug code to Arduino, it... worked. Now I reuploaded my code again (without any changes) and it started working as well. I am legitimately confused but also worried if it's not going to break at any time. Could anyone please explain?