Catalex/YX5300/YX6300 MP3 player - Mystery solved!

Jeff Haas

Senior Member
I have some of these nice little MP3 player boards, usually sold as "Catalex" MP3 players for a few dollars. Erco wrote them up in his column a few years back:

I've got a bunch I've acquired over the years, they all look alike, and they drift around from project to project without any problem...until recently.

It seems they have "upgraded" the players to make them slightly cheaper, and they removed a feature that used to work. This had me going nuts...why didn't my old code work?! It was so simple!

The feature that I can't get to work is the folders on the SD card. Take a look at this code, right after Main:

Code:
#Picaxe 08M2
SetFreq m8  'Must be set to 8mhz or 16mhz for Serout command to work at 9600 baud

Init: 

pause 1000    'Required for proper operation after power-up
serout C.2,T9600_8,($7E,$FF,$06,$0C,$00,$00,$00,$EF)  ' Reset/Init
pause 1000    'Required for proper operation after command
serout C.2,T9600_8,($7E,$FF,$06,$09,$00,$00,$02,$EF) 'Select TF socket on Catalex
pause 1000    'Required for proper operation after command
serout C.2,T9600_8,($7E,$FF,$06,$06,$00,$00,$0F,$EF) 'Set volume to half ($0F is 15 in hex)
pause 1000    'Required for proper operation after command

Main:

serout C.2,T9600_8,($7E,$FF,$06,$03,$00,$00,$01,$EF) 'Play the first song on the card (should be in folder 001)  << This works!
'serout C.2,T9600_8,($7E,$FF,$06,$0F,$00,$01,$01,$EF) 'Play 001 folder, 001 song  << This DOES NOT WORK ANY MORE
pause 12000    'Frequency is 8mhz, so this is actually 6 seconds


serout C.2,T9600_8,($7E,$FF,$06,$0E,$00,$01,$02,$EF) 'Pause playback
pause 12000    ' 6 seconds
Since the player can play files from 1 - 255, this is no big loss. Just name all your files like 001xxx.mp3, 002xxx.mp3, etc, copy them to a microSD card in a folder named 001. Then use the first version of the command, changing the last "$01" to the number of the file. Whew!

I even went through the two Arduino libraries that are out there...guess what? One of them doesn't bother with the folders, either.
 

erco

Senior Member
That's a funky downgrade. Thanks for staring that, one less future headache!

Is it marked YX 6300? Mine are 5300.
 

Jeff Haas

Senior Member
One of each did the same thing! If I could figure out which of mine are the old ones I would see if there's any difference marked on them.

Also, you can use "Play with volume" if you need to as well. But I just set volume in the setup and adjust the volume knob later.
 

erco

Senior Member
I have some due to arrive from AliExpress soon, will have to test. Is there a way to get the firmware revision from the module? I've never looked at serial data out from the module. The only deviation I have noticed is that some modules only play MP3 files, although the used manual says WAV files work too. They don't. No response.

These modules work great once you understand how they work. The player has its own microcontroller doing its own thing and you have to give it "time to catch up". They def need a pause after each SEROUT command, as shown in your code:

pause 1000 'Required for proper operation after command

That's a half-second pause at 8 MHz. I don't pause quite that long, I think 100 or 200 ms is sufficient IIRC from my testing. And while testing, when in doubt, cycle the power and let the player reset. Hard to know exactly what's going on in there.


I have also ordered ten of these modules to try: https://www.aliexpress.com/item/4000531948607.html I think similar function but they have 4MB flash memory onboard for the sound files instead of using an SD card, which often costs more than the YX5300! 4MB is sufficient for some projects.

BTW Jeff I hope we'll see you doing something in the Figure 8 thread over yonder. Tenth anniversary!

mp3.jpg
 
Last edited:

Jeff Haas

Senior Member
That new module looks interesting...including the class-D amp onboard could save space.

I found an Arduino library on Github:

And here's a tutorial based on the library:

Commands are farther down the Github page, they are similar to the YX5300. Should be easy to make work. Keep us updated when they arrive!
 

erco

Senior Member
Good links, the datasheet is within that tutorial, more specifically get it HERE.

Too big to attach here.
 

erco

Senior Member
My DY-SV17F MP3 player modules arrived and we have a winner! Built-in 4MB flash memory, audio amp, even software-selectable equalizer: normal, pop, rock, jazz, classic. I just started playing with a tiny bare 8-ohm pillow speaker (amplifier specs say 5W into a 4-ohm speaker) so I'm not exactly getting high fidelity sound but I do hear differences in the various EQ filters. The module has several different operational modes which can utilize numerous input pins for individual song triggering, and/or a one-line bus, in addition to the standard serial comms like the YX5300 mp3 module. The latter is what interests me.

But it's not quite as user friendly as the YX5300:

1) You have to add checksums in hex; the real programmers among you will love it. I cheated and used Win10's programmer calculator.
2) As noted in the Github article Jeff referenced, the onboard memory is finnicky. Files don't necessarily play in sequential order just because you remamed them in order:
  1. Empty the storage device.
  2. Make sure there aren't any trash files on the storage device. (I did a quick format)
  3. Copy the files in the order they should be played (it helps to have them named sequentially, sort by name and copy the files, usually they will be copied in sequence order.
Info is kinda spread out between websites. I've got the module doing all the basic stuff using just one pin on an 08M2 (8Mhz req'd for 9600 baud) . Track selection, play, pause, volume, EQ selection. Really nice, glad I got ten pieces. For reference, the 4MB memory can hold one 3-minute song MP3. Or quite a lot of shorter sound files. I could have used these in many prior projects which used a YX5300, which requires a micro SD card.

I'll make a video at some point and share more info. Starter code attached.
 

Attachments

Last edited:

erco

Senior Member
My board came preloaded with 4 sounds named 00001.mp3- 00004.mp3 which worked fine and played in numerical order using the NEXT command. Later I added some files to the flash memory and renamed them in flash as 00005.mp3 and 00006.mp3 but then they played out of order. Solved by following those 3 instructions above.
 

hippy

Ex-Staff (retired)
There's a utility called DriveSort which does a good job on PCs.
That's definitely a useful tool. The slower option is to format the SD card then drag files over one at a time in the order required. A drag and drop of all files often works but isn't guaranteed.

One can often add files in sequential order to the SD card but watch out for replacing a file with a later version as that will often add it to the end and leave a gap in the directory where it was which may then get replaced by the next file added.

The best way I found was to keep a directory on the PC with the files there, format the SD card, drag and drop the files over, run DriveSort if they don't play in the order expected, or just to ensure they do.
 

Jeff Haas

Senior Member
You don't really need to format the SD card over and over...just copy the new or updated files to the card, then run DriveSort. I've done this for years and the use of DriveSort is what makes things dependable.
 
Top