DFPlayer Bug

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

DFPlayer Bug

Post 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 8139 times
Does anyone see something I'm missing.

Maybe my DFplayer has bitten the dust before I begin.

John

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: DFPlayer Bug

Post 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.
Martin

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: DFPlayer Bug

Post 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
Attachments
RS232 to DFplayer.jpg
RS232 to DFplayer.jpg (123.32 KiB) Viewed 8040 times
DFPlayer Count up down 16F1938.fcfx
(24.64 KiB) Downloaded 211 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: DFPlayer Bug

Post 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.
Martin

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: DFPlayer Bug

Post 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

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: DFPlayer Bug

Post 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
Attachments
DFPlayer Count up down Mar13.fcfx
(27.02 KiB) Downloaded 207 times

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: DFPlayer Bug

Post 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....>>>>
Attachments
Transmit.jpg
Transmit.jpg (110.31 KiB) Viewed 7884 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: DFPlayer Bug

Post 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?
Attachments
DFPlayer Count up down Working.fcfx
(13.7 KiB) Downloaded 223 times
Martin

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: DFPlayer Bug

Post 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

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: DFPlayer Bug

Post 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?
Martin

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: DFPlayer Bug

Post 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

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: DFPlayer Bug

Post by JLeith »

Hello Martin

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

John

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: DFPlayer Bug

Post 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.
Martin

Post Reply