ArduinoGeneral

DFPlayer and USB flash drive

userHead rhasta 2018-10-27 07:21:18 1628 Views1 Replies
The datasheet says it is supposed to answer to the 0x3F command with 0x01 as the 2nd parameter when there's a USB drive attached, 0x02 when it's a SD card and 0x03 when there's both.

I would think it should answer 0x00 when there's no USB drive or SD card but it always answer 0x01 when there's nothing attached. Here's what I get:

Nothing : 0x01
USB only: 0x01
SD only: 0x02
USB + SD: 0x03

When I have both attached and I remove either, I get the right reply (0x02 if I removed USB and 0x01 if I removed SD) but if I remove both, I still get 0x01. If I attach the USB drive after the DFPlayer is powered I get the 'card in' message but if it's powered with the USB drive already attached, I do not get that message and I'm back to square one.

Is there a way to reliably detect if a USB drive is really attached? If I get a 0x01 reply when there's no USB drive attached and I query the track count, I get 1 as the result and this tells the MCU the wrong thing and all hell breaks loose. It's really the only quirk I have left to work out. Other than that, everything is working 'beautifully.'

Any ideas?

Thanks.
2018-10-27 11:11:52 Funny how you always find a 'solution' after asking.

It still reports that there is a USB drive attached when there isn't, but the '1' track that was messing everything turned out to be the 2nd parameter of an error message sent by the player when asked how many tracks there are for a device that is offline. So I can work with that.
userHeadPic rhasta