Page 1 of 1

DFPlayer Bug

Posted: Mon Feb 25, 2019 9:36 pm
by JLeith
Hello All

Working on a new Christmas train design with a audio file playing when a train enters the station

Using a DFPlayer Mini and a Speaker

I have it running on a Pic16F1983 but it is not working.

So I have gone back to basic with just the DFPlayer

Using the DFPlayer Mini with the ADKEY1 activate

I have a MP3 File on the Sim card. Double checked that the MP3 is playing on my PC.

When I press my button to play Segment 1 all I get on the speaker is BUZZ.....BUZZ

The Blue light activates and then the Buzz

Here is my simple design
AD Key Mode.jpg
AD Key Mode.jpg (38.65 KiB) Viewed 8316 times
Does anyone see something I'm missing.

Maybe my DFplayer has bitten the dust before I begin.

John

Re: DFPlayer Bug

Posted: Tue Feb 26, 2019 6:10 am
by medelec35
Hi John,
That could be down to a poor power supply.
If using switch mode try linear for now. If works with linear then power supply is confirned.
You then then try different switch mode versions.

Re: DFPlayer Bug

Posted: Fri Mar 08, 2019 3:45 am
by JLeith
Hi Martin - I have been away and now leaving to Regina for my Daughters Graduation from RCMP Police Training.

I had to purchase a new power supply and I got it working but can't get the PIC to activate.

I did the IO_2 via RC3 and it works. I do see something on my digital scope being sent to the DFplayer on TX pins but the Dfplayer does not respond.

On the LCD I see the Version as 255 but the "Count" does not appear. I see the count on the Flowcode Demo.

I'm trying to follow the TX code but I can't find the code the DFplayer needs. Google does not help ??
I found a couple of commands?
0x07E = Stop Command
0x0FF = Version Information
0x0EF = End command
And I think the Low and High Byte is the MP3 file.
I have the MP3 files in the Folder Labeled MP3

When I trigger the IO_2 from RB2 it counts. So the DFplayer and MP3 files work.

I found a program to help show my connections.

My goal is to have the Push Button on RB0 to activate different DFplayer MP3. I cant even get the Busy light to come on. And play just 1 MP3

Thoughts, John

Re: DFPlayer Bug

Posted: Fri Mar 08, 2019 6:28 pm
by medelec35
Hi John,
If you look a the DFPlayer datasheet, it will state that all commands start by sending 0x7E.
If you look at your flowchart, within SendBytes macro the send 0x7E has been changed to Receive and 0x7E you supposed to be sending is being used as the Timeout.
You need to change it back!
Same with Versioninfo and the rest that are wrong.

I have mentioned before about doing a 1-sec flash test

If you did you will see the timings will be out as the clock is set to 19660800 Hz (which means URART timings will be way out, stopping DFPlayer from working).
It should be set to the speed of the internal osc i.e 8000000 (8MHz)

The volume command (0x06) is set to 03 which is a low volume level.
Try 15 or higher.
If you correct as many errors as you can.
If still not working if you post updated flowchart, I will take another look.

Re: DFPlayer Bug

Posted: Wed Mar 13, 2019 7:01 pm
by JLeith
Hi Martin
Just got back form Regina (-25). Our Daughter graduated and now is a Constable ( Police Officer ) after training for 6 months.

I will study you information. I had the C3 as timer just not 100% how to set up the Flash test.

Off to work on the project.

Back soon

John

Re: DFPlayer Bug

Posted: Thu Mar 14, 2019 2:49 am
by JLeith
Hello Martin

Well I have tried and have a grasp on the flow but can't get the DFplayer to play.

This is what I have put together.
1. Figure out the values
StartByte = 0x7E //START Command
Length = 0x05 // Data Length
Commands = 0x0B //Normal Working
VersionInfo = 0xFF // Version Number
CommandFeedback = 0x00 // Do not Respond
Parameter1HighByte = 0x00 // Track High Byte [DH}
Parameter2LowByte = Count //Track number [LB]
ChecksumHighByte = 0xFF // ChecksumHighByte
ChecksumLowByte = 0xE6 // ChecksumLowByte
EndBit = 0xEF // End Command

Step 2..
Send the Information to the DFplayer.

I have my digital scope on the PIC TX and I see the information sending.

Step 3. The scope indicates the pattern doesn't go away just changes a few up and down traces based on the Count.

What I did notice is with the clock set to 8K I don't hear the IO_1 from RC2. I have to be around 12 - 19K to get the IO_1. to work.
Even then I can't get the Count to broadcast.

Flowcode copy attached

John

Re: DFPlayer Bug

Posted: Thu Mar 14, 2019 8:19 pm
by JLeith
Hi All
Update info

This is a Screen shot for my DFplayer

It won't play via the RX / TX interface.

I have tried various Commands and I can't get it to respond.

Not 100% sure on the trace.

Even placed a delay of 1ms between sending value.....no change

Will keep on trying.....Google....>>>>

Re: DFPlayer Bug

Posted: Thu Mar 14, 2019 10:29 pm
by medelec35
Hi John,
Before diving into your program, it may be wise to test DFPlayer and wiring first.
Try the attached working program without making any modifications except volume level as its fairly low.
If it works then I will see where you are going wrong.
Do you have a UART to USB converter?

Re: DFPlayer Bug

Posted: Fri Mar 15, 2019 12:58 am
by JLeith
Hello Martin

With hours searching on Google I found a link that got it going.

Looks like my CheckSum was wrong.
This Hex made it work ( 7E,FF,06,03,00,00,01,FE,F7,EF ) it plays digit 1 over and over
This Hex also works ( 7E,FF,06,01,00,00,00,FE,FA,EF ) It goes from 1 - 12 count and then back to 1-12

// 7E FF 06 0F 00 01 01 xx xx EF
// 0 -> 7E is start code
// 1 -> FF is version
// 2 -> 06 is length
// 3 -> 0F is command
// 4 -> 00 is no receive
// 5~6 -> 01 01 is argument
// 7~8 -> checksum = 0 - ( FF+06+0F+00+01+01 )
// 9 -> EF is end code
Now I just have to learn the Checksum formula ( Version + Length + Command + No Receive + Par 1 + Par 2 )

Is there a way to send the Hex in a single line ?

John

Re: DFPlayer Bug

Posted: Fri Mar 15, 2019 6:42 am
by medelec35
The program I posted automatically calculates the correct checksum for every command.
Is that where you are learning the checksum formula from?

Congratulations to your daughter, you must be one proud dad?

Re: DFPlayer Bug

Posted: Fri Mar 15, 2019 4:50 pm
by JLeith
Hi Martin

For the check sum I found a link on Google for DFplayer for Arduino an they had the steps but not a clean explanation on how to get the High and low settings.

I downloaded your program and will give it a go.

It was a proud moment when I daughter received her badge with tears of happiness

Off to play with programming.

John

Re: DFPlayer Bug

Posted: Fri Mar 15, 2019 5:01 pm
by JLeith
Hello Martin

Your program counts perfect
Happy.jpg
Happy.jpg (5.59 KiB) Viewed 8031 times
I going to study and see how to ask for a single mp3.

John

Re: DFPlayer Bug

Posted: Fri Mar 15, 2019 6:30 pm
by medelec35
Hi John,
The high and low number is just a 16bit integer number that has been spilt into two bytes!

Code: Select all

Track number (integer)       HighByte   LowByte
1                                0         1
2                                0         2
3                                0         3
...
255                              0        255
256                              1         0
257                              1         1
If the track you are interested in is track 4 just use:

Code: Select all

Commands = 0x12
CommandFeedback = 0x00
Parameter1HighByte = 0//Track number HB
Parameter2LowByte = 4 //Track number LB
You don't have to use hex.
If the track you are interested in is track 280 just use:

Code: Select all

Commands = 0x12
CommandFeedback = 0x00
Parameter1HighByte = 1//Track number HB
Parameter2LowByte = 24 //Track number LB
You can see how the HighByte & LowByte is calculated from this post.