Have been wrestling with the DFPlayer mini (cheapo copy) and have most of the functionality.
But I can't get an accurate folder count.
I Have microSDCard loaded up with album folders which are numbered 01, 02,...93
I wrote a copy files facility in C# so as the folders and files load onto the card in the right sequence
File names are as they are on the PC not 001.mp3 etc, but everything else does work with them and sometimes this does and sometimes not.
myDFPlayer.readFolderCounts() returns -1
If I loop through myDFPlayer.readFileCountsInFolder(folderCount) it works correctly on some folders but not on all. (returns -1)
(looping through that does seem to slow down after about 15 loops)
I have tried looping backwards from 99 to try and find the first folder with files but it doesn't stop at the correct 93 but 89 or 87.
I have tested to find out that it is not the files in the folders that cause this as if I load up a card with a different number of folders it may find fileCount of a folder that it didn't before.
This is the same on different SDCards, new and newly formatted.
It's driving me nuts as I have all the functionality working apart from this.
I have tried on Nanos and ESP32s.
I have implemented IR remote control facility.
Finally got it to work.
The myDFPlayer.readFolderCounts() is returning the folder count.
I have changed the setTimeOut I had at 1000 to 2000
myDFPlayer.setTimeOut(2000); //Set serial communication time out 500ms.
I'd also moved it up to top of the reads bit. Haven't tested putting it back further down.
Off out for some fresh air.
folderCount = myDFPlayer.readFolderCounts();
finalTrackNo = getFinalTrackNo();
Serial.print("folderCount DF "); //Number of folders on the SD card
Serial.println(myDFPlayer.readState()); //read mp3 state
Serial.println(myDFPlayer.readVolume()); //read current volume
Serial.println(myDFPlayer.readEQ()); //read EQ setting
Serial.println(myDFPlayer.readFileCounts()); //read all file counts in SD card
Serial.println(myDFPlayer.readCurrentFileNumber()); //read current play file number
It turns out that 3 of the 6 DFPlayers I have aren't doing the reads and 3 of the are.
I bought them in 2 chunks of three from different suppliers.
But I'm not getting an accurate folder count sometimes on the ones that do read.
You probably have clones.. that are NOT using the YDX5200 chip set perhaps?
I had some 'clones' as well.. as they wouldnt do any querying of the chip either.. just simple playback stuff..