About 1053 - Please check my schematic

Designing hardware that uses VLSI Solution's devices as slave codecs such as an external MP3 decoder chip for a host microcontroller.
Coltfish
Senior User
Posts: 22
Joined: Wed 2011-03-09 10:35

Re: About 1053 - Please check my schematic

Post by Coltfish » Wed 2011-03-16 11:49

demonoR wrote: I tried to send 1411.2 Kbps wave NOT WORKED I mean I got lagged sound.
So if wave is not working I think flac will not work..
No, 1411 kbits/s should be possible with your ATMega. Might need some tweaking of your code, though. You don't tell anything about your storage media / File System you are using. Perhaps there is a performance issue.

Increasing the ATMega's internal clock rate will definitely help to speed up the transfer, although the maximum SPI frequency supported by the vs1053 is limited (check datasheet).
You should use a circular buffer of something like 4 kByte to store some sectors and feed the data in 32 Byte Blocks to the vs1053 using an interrupt, every time DREQ gets high.

demonoR
Senior User
Posts: 59
Joined: Sun 2011-01-16 20:08

Re: About 1053 - Please check my schematic

Post by demonoR » Wed 2011-03-16 15:43

I am using micro sd card, 4Mhz spi, and FAT32 file system
I took fat32 library from

http://www.dharmanitech.com/2009/01/sd- ... fat32.html

Coltfish
Senior User
Posts: 22
Joined: Wed 2011-03-09 10:35

Re: About 1053 - Please check my schematic

Post by Coltfish » Wed 2011-03-16 16:05

From the refered website:
Data transfer rate: 1 raw data block (512 bytes) takes 4.15ms for reading or writing (123.37 KBytes/s) at current 4 MHz SPI clock rate. If you have flash more than 8k, you can declare the SPI_receive() and SPI_transmit() functions as 'inline' functions. This will increase the transfer rate to 140 KBytes/s. These transfer rates can be further increased by using a 16MHz crystal (8 MHz SPI clock). FAT32 file reading is done at 78 to 91 KBytes/sec.
OK, 91 KBytes/sec max. is pretty slow. FLAC/WAV won't work at this speed, that's for sure.
You will need to optimize the FAT32 library. Reading from SD-Card at 180 KB/sec should be possible when clocking the AVR at 16 MHz and using a File System.
The SD-Card SPI should work at least up to 20 MHz, so this should not be a limitation in your case.

demonoR
Senior User
Posts: 59
Joined: Sun 2011-01-16 20:08

Re: About 1053 - Please check my schematic

Post by demonoR » Wed 2011-03-16 16:49

So I need to have external crystal 16 Mhz or 20 Mhz, yes? hmm About optimization, I am not so good in that area :) But you think that with atmega possible to send wav or flac? And about reading faster to read something like 128 256 512 1024 or bigger block of data in one time? Or i will get the same performance?
and about micro sd card, I am using Kingston micro sdhc 8gb.

Device ATmega324P
Flash 32 Kbyte
EEPROM 1 Kbyte
RAM 2 Kbyte

Coltfish
Senior User
Posts: 22
Joined: Wed 2011-03-09 10:35

Re: About 1053 - Please check my schematic

Post by Coltfish » Fri 2011-03-18 14:56

demonoR wrote:So I need to have external crystal 16 Mhz or 20 Mhz, yes?
Using the maximum possible clock speed is usually the first thing that I would try if I ran into performance issues ;)
demonoR wrote:And about reading faster to read something like 128 256 512 1024 or bigger block of data in one time? Or i will get the same performance?
and about micro sd card, I am using Kingston micro sdhc 8gb.
Reading from a SD card ist always done 512 Bytes a time, as this is the physical sector size.
demonoR wrote: Device ATmega324P
RAM 2 Kbyte
That's bad. You should select a device with more RAM, so that you can use a ring buffer to store at least 4 - 8 sectors.

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2736
Joined: Tue 2010-06-22 13:43

Re: About 1053 - Please check my schematic

Post by Panu » Sat 2011-03-19 10:16

I've used some creativity earlier to get big data rates from small microcontrollers... it requires some hardware tricks in the PCB design, though... there's some discussion in this thread (link is to my last post in the thread):
viewtopic.php?f=11&t=91#p493

The basic trick is not to buffer data inside the microcontroller at all, just pump it through to the VS chip byte by byte. How to achieve it, that's a different matter that needs to be solved case by case...

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

demonoR
Senior User
Posts: 59
Joined: Sun 2011-01-16 20:08

Re: About 1053 - Please check my schematic

Post by demonoR » Sat 2011-03-19 11:34

Can I ask you something about flac? To read flac, firstly somehow I need to send this full big array called

const unsigned short plugin[6676] = { /* Compressed plugin */

and after this send the flac? Is it correct? And there is one problem, the array is too big to fit in mcu, so I could put it inside my sd card, read it with mcu from micro sd card and send it to vs1053?

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

Re: About 1053 - Please check my schematic

Post by pasi » Sun 2011-03-20 1:06

demonoR wrote:To read flac, firstly somehow I need to send this full big array ... and after this send the flac? Is it correct? And there is one problem, the array is too big to fit in mcu, so I could put it inside my sd card, read it with mcu from micro sd card and send it to vs1053?
Right, the vs1053b ROM does not contain a FLAC decoder, it is part of the patches package. You can load it from the SD card. Note that it is compressed, so you need the short 'decompressor' to upload it to vs1053b. This load-from-SD method is also often used with the Ogg Vorbis encoder.

Also note that you only need to load the patches package once (after a hardware reset) if you replace software reset with the correct write to AIADDR (I think it was 0x300).
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

demonoR
Senior User
Posts: 59
Joined: Sun 2011-01-16 20:08

Re: About 1053 - Please check my schematic

Post by demonoR » Mon 2011-04-25 23:00

Here is one problem, I have checked that my microcontroller can work with 16 Mhz, but only with 4.5-5.5 V, all atmega microcontroller cannot work with 3V3, if I need 16 Mhz for FLAC, I need that 16-20 Mhz, what can you suggest for me? because I can damage my vs1053 with that voltage range.

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2736
Joined: Tue 2010-06-22 13:43

Re: About 1053 - Please check my schematic

Post by Panu » Mon 2011-05-02 12:54

Hi!

You can use a 3V to 5V level shifter IC between your MCU and VS1053. Or you can use a resistor divider for signals that go from MCU to VS1053. For signals from VS1053 to MCU, you can use a level shifter or transistor(s) or even direct connection via 1k resistor in most cases.

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Post Reply