VS1063 MP3 File not playing correctly

Designing hardware that use VLSI Solution's devices as the system controller for the entire design.
Post Reply
vtech
User
Posts: 7
Joined: Thu 2020-01-30 22:06

VS1063 MP3 File not playing correctly

Post by vtech » Wed 2020-03-18 19:24

I am struggling with getting a simple MP3 file to play using the player1063.c file. I successfully performed a software and hardware init and loaded the latest plugin. I am running on a PocketBeagle and have mounted a USB drive that contains the MP3 file that I am playing. I am feeding the bytes by reading via fread() of the file inside the function VS1063PlayFile(), but the only thing that I can hear is a quick garble of noise. The codec is obviously trying to play something, but its not intelligible. I didn't see any documentation that says I need to tweak any parameters as the chip should automatically decode the format, right?

vtech
User
Posts: 7
Joined: Thu 2020-01-30 22:06

Re: VS1063 MP3 File not playing correctly

Post by vtech » Wed 2020-03-18 23:46

Ok, I have some more info. It appears that the fread() is stopping prematurely due to a library issue on my side. However, now the MP3 file is playing and it is missing data during playing as indicated by gaps shown on my o-scope. In addition, the audio sounds robotic. My understanding was that the VS1063 can detect bit-rate, so there shouldn't be a need to configure that, right ? Also, the gaps in the playback imply starvation to the codec, but I don't see how. What SPI clock rate is recommended?

User avatar
pasi
VLSI Staff
Posts: 1703
Joined: Thu 2010-07-15 16:04

Re: VS1063 MP3 File not playing correctly

Post by pasi » Thu 2020-03-19 11:28

You only need to send the file data, respecting DREQ. So, check your DREQ and xDCS handling.

What's the bitrate and samplerate of the file, and what's the CLOCKF value you write? The default 1.0x clock can only decode the lower samplerate or mono files. The maximum SPI speed you can use also depends on the CLOCKF value.

The two most probable causes for playing too quickly are DREQ handling and extra or missing bytes in the transmission (maybe word/byte count mixups or changing the state of xDCS while the SPI is still transmitting).
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

vtech
User
Posts: 7
Joined: Thu 2020-01-30 22:06

Re: VS1063 MP3 File not playing correctly

Post by vtech » Thu 2020-03-19 15:37

The file has a bitrate of 121kbps. I am sending data appropriately respecting dreq and xDCS.

I dropped the bitrate down to 96kbps and the choppiness is gone and the audio plays fine, so it seems the chip is being starved. I didn't change the line from the code to change the clock rate :

WriteSci(SCI_CLOCKF,
HZ_TO_SC_FREQ(12288000) | SC_MULT_53_40X | SC_ADD_53_15X);

The speed of the SPI on my device is set to 2.4Mhz. The sample code gave a 24Khz speed which caused very poor results

User avatar
pasi
VLSI Staff
Posts: 1703
Joined: Thu 2010-07-15 16:04

Re: VS1063 MP3 File not playing correctly

Post by pasi » Thu 2020-03-19 16:31

What's your storage? Are you getting data quickly enough?

2.4MHz SPI is plenty to send the data to vs1063.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

vtech
User
Posts: 7
Joined: Thu 2020-01-30 22:06

Re: VS1063 MP3 File not playing correctly

Post by vtech » Thu 2020-03-19 19:17

I am using a USB stick as storage. It is definitely able to transfer fast enough. It is transferring at USB 1.0 speed currently and it tested at 11.7Mb/s which is more than adequate, right ?

User avatar
pasi
VLSI Staff
Posts: 1703
Joined: Thu 2010-07-15 16:04

Re: VS1063 MP3 File not playing correctly

Post by pasi » Fri 2020-03-20 10:12

vtech wrote:
Thu 2020-03-19 19:17
I am using a USB stick as storage. It is definitely able to transfer fast enough. It is transferring at USB 1.0 speed currently and it tested at 11.7Mb/s which is more than adequate, right ?
Average speed isn't the only deciding factor. What's the latency? When you read a block, how long it takes to return it? Do you get that sustained speed the whole time, or are there pauses?

If there are no pauses, then check your SCI register write and read routines and read back the value of SCI_CLOCKF, and for reference SCI_MODE, SCI_STATUS, and SCI_AUDATA.

If you have an oscilloscope, add GPIO debug to see where your microcontroller spends its time. Especially see what the controller is doing whenever DREQ is high for long periods.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

vtech
User
Posts: 7
Joined: Thu 2020-01-30 22:06

Re: VS1063 MP3 File not playing correctly

Post by vtech » Tue 2020-03-24 16:50

Throughout the read from USB, I am printing the values and they are consistently as follows :

CLOCKF : B430
MODE : 820
STATUS : 60
AUDATA : AC44

Post Reply