SD Card Buffer
Kit Morton
Posts: 39
Hi all,
I have a vs1002 mp3 decoder and a sd card hooked of to my propeller, and I am trying to play the mp3 files from the card.
The problem is that I can't read the data off the card fast enough for the mp3 chip. So I need some way to buffer the data form the sd card. But I don't really have any idea how to go about it.
So does anybody have any hints or code examples for this kind of thing?
Thanks
-Kit
I have a vs1002 mp3 decoder and a sd card hooked of to my propeller, and I am trying to play the mp3 files from the card.
The problem is that I can't read the data off the card fast enough for the mp3 chip. So I need some way to buffer the data form the sd card. But I don't really have any idea how to go about it.
So does anybody have any hints or code examples for this kind of thing?
Thanks
-Kit
Comments
Are you using Rokicki's code ? If so, read 2048 bytes at once with "sdfat.pread", you will get about 400Kbytes/sec if your card is enough fast.
I think that is enough fast to play almost all mp3 files !!, but I never try that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
I just tried using pread, but I can't seem to get it to work. Are there any examples for how to use it. Because it doesn't work in the way that I thought it would.
Thanks
-Kit
I don't remember if in "Multi propeller board" thread is some code about this, but if not,· I'll try to post it early.
I can tell you now, what I did to get the 400Kbytes/sec in read.
1-I used sdfat.pread
2-I read everytime blocks of 2048 bytes each.
3-I used· four buffers, to put the data read from SD.
4-I tried to do nothing while read the SD...only one COG for that, in a repeat loop, and only looking for·a·status flag for the buffers, if they were read by the master COG.
5-I used a very fast SD card (150x)
6-I maintain all wires between SD and the propeller very short (Look at my multipropeller board pictures)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
Post your code so people can look at it. Generally it is easier for people to find your problem by looking at your code snippets. I personally just skip over threads where there is no code since it is nearly impossible to guess what is wrong.