I've been having issues with the Adafruit Audio FX Sound Board (16mb, no amp version) in UART mode, connected to an Arduino Uno. After two 4am nights I've got them working reliably but there is strangeness involved. I noticed a lot of other people having issues with the same board on this forum so I'm posting this in case it helps. These steps work for all 4 of the boards I've used.
Issue 1: You put files on the board but they won't play in UART mode
1) The board shows up as a drive in Windows 10
2) Copy 2 audio files onto it called 'TRACK001OGG' and 'TRACK002OGG'
3) Eject the drive from the computer
4) Connect to Arduino and power up the Audio FX in UART mode
5) Call sfx.listFiles()
Code: Select all
void listFiles() {
uint8_t files = sfx.listFiles();
Serial.println(": Audio file listing");
Serial.println("========================");
Serial.println();
Serial.print("Found "); Serial.print(files); Serial.println(" files");
for (uint8_t f=0; f<files; f++) {
Serial.print(f);
Serial.print("\tname: "); Serial.print(sfx.fileName(f));
Serial.print("\tsize: "); Serial.println(sfx.fileSize(f));
}
Serial.println("========================");
}
7) Call sfx.playTrack using a track name
Code: Select all
char fullName[13] = {'T', 'R', 'A', 'C', 'K', '0', '0', '1', 'O', 'G', 'G', '\n'};
if (!sfx.playTrack(fullName)) {
Serial.print("Failed to play");
}
9) Unplug power to the Arduino and SFX board
10) Plug in power again. This time Listfiles reports '0' files.
11) Connect SFX drive to computer. Windows 10 reports a drive problem and offers to fix it. Windows fixes it for Windows, but it still doesn't report any files via Arduino.
12) The SFX board seems to be broken.
If this happens:
1) Re-image the SFX board using the image on the Adafruit support page.
2) Re-copy the audio files onto the board
3) Make sure to wire up the RST pin and call sfx.reset() from Arduino before calling any other functions. Just re-powering the board doesn't seem to do a full reset, causing the board to seemingly corrupt itself when you call a function.
If the board won't show up as a drive in Windows any more... move on to issue 2.
Issue 2: The board doesn't show up when you try to mount it in Windows
In my case this was because I had the RST pin connected to a powered-down Arduino while the SFX board was corrupt. After disconnecting the RST pin, the drive showed up as expected. After re-imaging the SFX board it worked fine with the RST pin connected.
Issue 3: Calling sfx.stop() twice seems to break the board
1) Call sfx.playTrack using a track name
Code: Select all
char fullName[13] = {'T', 'R', 'A', 'C', 'K', '0', '0', '1', 'O', 'G', 'G', '\n'};
if (!sfx.playTrack(fullName)) {
Serial.print("Failed to play");
}
Code: Select all
if (sfx.stop()) {
Serial.println(": Track stopped");
}
else {
Serial.println(": Failed to stop track");
}
3) If you call sfx.stop() for a second time, when the board is already stopped (in standby mode), you get 'Failed to stop track'.
4) Calling play once now doesn't work. You need to call play twice to get a file to play. It seems that calling stop in standby mode "double stops". You need to "double play" to get out of the mess. The code below works well to avoid double stopping but seems really silly.
Code: Select all
void stopTrack() {
// Try to stop audio and return to standby
if (sfx.stop()) {
Serial.println(": Track stopped");
}
else {
Serial.println(": Failed to stop track");
soundFix(); // SFX board backstack fix/hack
}
}
void soundFix() {
// Play track 1. It won't play but instead gets you out of the double stopped state.
uint8_t n = 0;
if (sfx.playTrack((uint8_t)n)) {
// If, somehow, the track does play, stop it. That wasn't supposed to happen. This is optional. It has never fired but is there just in case.
Serial.println(" Error: SFX board backstack fix failed");
sfx.stop();
}
}