Wow ! It's Working ! But playing too fast !!! (PIC18+STA013)

General discussion on mikroC.
Post Reply
Author
Message
CyberArtem
Posts: 34
Joined: 21 Mar 2009 15:13
Location: Israel

Wow ! It's Working ! But playing too fast !!! (PIC18+STA013)

#1 Post by CyberArtem » 14 Apr 2009 00:57

Hello All :)
I have a small problem considering STA013 Mp3 decoder.
I have managed to get it work ! (at last !) My mp3 player around Pic18. Using SD with FAT, STA013 Mp3 decoder with CS4334 24Bit DAC, but it plays the songs too fast, the voices and music sound funny.
I have tried to fix this by playing with the STA013 control data file, but without success. I am using 14.7456Mhz crystal for the STA013. In the data sheet i found no ways to control play speed. The data transfer and other devices such as LCD working perfectly.
Please help me to figure what's wrong.

Ty :lol:

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#2 Post by Mince-n-Tatties » 14 Apr 2009 10:00

dont have one to give absolute answer but in general with digital audio it sounds like you describe a clock mismatch, this could either mean the sample rate at which the music was encoded at was wrong or that the current clock rate for reading the data back is not matched to the file encoded rate.

what is the digital transfer mode. i will need to grab a look at the data sheet for the parts.

i take it the 14.7456Mhz crystal is to give accurate baud/SPI rates

it could just be some register setting that needs a tweak.

give some details about the circuit, what clocks do you have "all of them" and have you used a scope to look at the sdata with clock? have you checked to see there are no interface issues like the input of the dac needs to have clock inverted with respect to data output of STA013 kind of thing. i am not saying thats the case i am just asking that the digital interfacing is matched (i have seen this type of issue with multiple I2S products from the same manufacturer not matching).
Last edited by Mince-n-Tatties on 14 Apr 2009 16:09, edited 1 time in total.

CyberArtem
Posts: 34
Joined: 21 Mar 2009 15:13
Location: Israel

#3 Post by CyberArtem » 14 Apr 2009 12:26

Hello again.

After a sleepless night of experiments with the configuration file i finally got it working ... almost. Mince-n-Tatties gave me an idea about sampling rate/frequency configuration i played with it a bit and it looks like it helped. The music is playing as it should be now but i have a strange pause problem now, every short time 2-3 times a second the music stops for a moment and plays again. It can be low data stream feeding rate issue but again it was all fine with the feed rate before i solved the "fast play" problem. I m working on this now ,
anyway thanks for help Mince-n-Tatties , i will post any new developments about the subject. if you guys have any idea what this "pause" problem might be please share your ideas.

Th all :D
Last edited by CyberArtem on 14 Apr 2009 12:43, edited 1 time in total.

CyberArtem
Posts: 34
Joined: 21 Mar 2009 15:13
Location: Israel

#4 Post by CyberArtem » 14 Apr 2009 12:34

Oh... and some info about the circuit ...

Using PIC18f4455 with 24Mhz Crystal
STA013 with 14.7456Mhz
Pic to STA013 and to SD card 3.3v logic
STA013 to cs4334 3.3v (cs4334 is working on 5v)

Image

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#5 Post by Mince-n-Tatties » 14 Apr 2009 16:31

so you have mostly a 3v system including pic. Now the digital interrface between the STA013 & CS4334 - STA013 at 3v and CS4334 at 5v does this meet with Vih for the digi data and the clocks? (i have not read data sheet).

EDIT: I just checked and the Voh 2.55v to Vih 2.0v min, is within margin

do you take all the clocks for CS4334 from the STA013?

for the pause in audio, this sounds almost certain to be buffer related. how do you deal with data requests from the STA013? are you using interrupt input on the PIC to service this?

Its hard to give exact ideas without having seen the schematic...

do you share the PIC SPI port between SD card and STA013? such that you perform a block transfer type system?

do loop
chip select SD card, pull data block, store in pic RAM, deselect SD card
chip select STA013, push data block across, deselect STA013

if so then you must use the data request line (i have to assume you are doing this already) from the STA013 and you must have data ready long before its requested (so that you can time share the SPI bus).

CyberArtem
Posts: 34
Joined: 21 Mar 2009 15:13
Location: Israel

#6 Post by CyberArtem » 14 Apr 2009 17:13

Hi again !
It's working it's working !!! At last ! it's working perfectly !
I have connected STA013 outputs to CS4334 to some transistors that drive LEDs to show the line activities. After i have removed them suddenly all begun to work fine. I have no idea how this was affecting the circuit that causes pauses, well it works now :D !
I use the same SPI bus to the SD, STA013 and for EEPROM.
It works like this:
I select only one device at a time. And switch between them if i need access.
The STA013 BIT_ENA is simply connected to SD card /CS, if i access the SD the BIT_ENA is getting LOW and STA013 not getting any data.
When i am done with the SD the BIT_ENA gets HIGH and i can send data to STA013. I access to EEPROM only to read the configuration file at the beginning so i am not using EEPROM /CS anymore. This way the data goes or to/from the SD or to the STA013. I have a feeding data loop its polling the DATA_REQUEST and if it HIGH i write to STA013 if not , i do some other stuff like checking the buttons or LCD text updates. Well that's it , another finished project for me 8)
Now what's left is to add some minor software modifications and put it into a box. I also plan to add a remote control and perhaps to replace the buttons with a small touch screen.
And again thank you Mince-n-Tatties for helping me :D

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#7 Post by Mince-n-Tatties » 15 Apr 2009 15:04

CyberArtem wrote: When i am done with the SD the BIT_ENA gets HIGH and i can send data to STA013. I access to EEPROM only to read the configuration file at the beginning so i am not using EEPROM /CS anymore. This way the data goes or to/from the SD or to the STA013.
food for thought...
consider storing the setup file data on the SD card. drops a device, saves cost and reduce power consumption and the complexity of the PCB while making it easier to change the setup using any PC and an SD card reader
CyberArtem wrote: I have a feeding data loop its polling the DATA_REQUEST and if it HIGH i write to STA013 if not
This would be a great area for you to expand into interrupt usage! dont spend time polling when you can service a need "when and only when its required"

CyberArtem
Posts: 34
Joined: 21 Mar 2009 15:13
Location: Israel

#8 Post by CyberArtem » 18 Apr 2009 13:03

Hi !

That's what i actually do, i store the config file on the SD and then if i need to update the firmware by pressing a button during power on of the Mp3 Player it reads the file from the SD and writes it to the EEPROM. So i dont need to keep the data file on the SD , because it might be deleted on the SD. It's not a good idea to keep your firmware on user accessible media. Imagine you keep your BIOS on a hard drive :wink: .That way i can update the config file when i need it from the SD. Besides i use SPI serial EEPROM in DIP8 package it does not take much space and wiring.

Considering the interrupt idea you're right. It's an lame way to poll for request every time. Soon i will modify the software to use interrupts.

Thanks again Mince-n-Tatties :)

omaraf
Posts: 2
Joined: 19 Nov 2016 22:17

Re: Wow ! It's Working ! But playing too fast !!! (PIC18+STA

#9 Post by omaraf » 20 Nov 2016 05:15

Hello CyberArtem
I am working on this decoder I am facing some difficulties
could you send to me a copy of you code
and if you have schematic for the decoder circuit that will perfect

Post Reply

Return to “mikroC General”