Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reading issue with DFmini type AA20HFJ648 #55

Open
Lutz1966 opened this issue Nov 18, 2023 · 3 comments
Open

reading issue with DFmini type AA20HFJ648 #55

Lutz1966 opened this issue Nov 18, 2023 · 3 comments

Comments

@Lutz1966
Copy link

With the AA20HFJ648 module, reading from the chip does not work for some functions. The number of files in a folder is output incorrectly.
It is often reported that -1 is returned. This is the case if the number is only requested for one folder and the volume or EQ has been set beforehand, for example.

If you request the same folder several times, the 2 or 3 result is returned correctly.

I have checked the communication on the bus, the result is already sent from the Arduino to the PC before the DFmini has responded.

In the code I found that if you set volume or EQ, the return value is not waited for, if I have understood everything correctly. However, the AA20HFJ648 confirms every command, i.e. if I request the number of files after setting the volume, the confirmation response from volume is in the receive buffer. This data is then interpreted incorrectly and obviously output as -1.

A correction would be to clear the receive buffer before each command is sent to which a response is expected. It would be more elegant to read this confirmation for versions that confirm every command.

@Lutz1966
Copy link
Author

I have done some improvements and it seems it will work, the changes are described here
https://forum.arduino.cc/t/dfplayer-mini-library-dfrobotdfplayermini/1193601

@Lutz1966
Copy link
Author

Lutz1966 commented Nov 26, 2023

DFRobotDFPlayerMini.zip
my changes to the original library

for normal use you have to comment out the debug options in the header file (line 37 & 38), it use some bits from portc, i used it for debugging with a logic analyzer, it's more real time like the serial messages

if you will use this debug function you have to add this line in your arduino source code to set the pins as an output
DDRC=DDRC|0x1F;

@fiz1962
Copy link

fiz1962 commented Jan 10, 2024

This fixed readVolume() for me. It would be nice to get it merged into the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants