Read from sd card

Is it possible to maximize the reading speed from the sd card?

To increase speed anymore you’ll either need to dig into the firmware or use RLP.

One trick with the normal firmware would be to read in multiples of 256bytes which is the SD read/write chunk size.

How do you use rlp to read In data once you have created the filestream in c#?

That’s not possible. You’ll need to write all the SD/DMA code yourself (including FAT filesystem code) when going to RLP. I did this for a customer on the EMX (FEZ Cobra).

A great start for me was the FATFS open source library: FatFs - Generic FAT Filesystem Module

The problem is I have very very limited time :frowning: my project is due in 2 weeks time n I need to get this video player working. Is there no other way to read data faster? I have done the rest of the code I.e. Getting the frames n stuff n its displaying bt its out putting the frames to slow. I’m jus sending the buffer array through rlp and rlp is doing all the decoding and when more data is needed it returns from rlp and more data is read and then the rlp is called again…Any ideas.? Please… Anything would be helpful

You’re working on the Hydra right?

Yes I am. Its just the speed that’s the problem at the moment. Then I need to sort the audio out. … If u can help me in anyway I’d be really grateful…

You’re attempting to make a video player with full audio on an ARM device with managed and native C with 2 weeks remaining and you haven’t even started audio yet?

I’m sure the community will do it’s best to help you out, but as far as I’m aware no one has done full decode of audio and video simultaneously on a NETMF device yet. We’ve seen video, we’ve seen audio. We haven’t seem them side-by-side yet.

If you manage it, it will be a fantastic project; however I’m not sure 2 weeks is realistic. Hopefully this project is for school and not work as school would be more understanding of speed issues brought on by device choise

Its for my final project . I’m studying computer engineering. The audio will be done using the music shield that I have n will be initialized in the beginning and once rlp does the processing it will store the audio data in the last byte array. A thread will be used to constantly read that byte array and output it to the music shield. That’s my logic behind it. I hope it will work. Any other ideas on what I could do?

Would you please update your profile with a name? :slight_smile:

You’re going to need to rewrite the music module’s driver since it requires you to send the entire audio file and you probably won’t have the RAM available for that.

I know Wouter’s got code for the SD stuff but he put a LOT of time into it and I’m not sure that’s code he’s going to share out. What if you reduced the resolution of the video and either scaled it up or centered it? That might make enough of a difference that the SD speed you’re getting is enough. Also make sure you read in those multiples of 256 it will make a difference in comparison to using other sizes.

It was either that I used the music module or a digital to analogue ic…(Since the hydra doesn’t have a dac) . Since its pcm audio data. It can be jus out putted through pcm. … Its jus the frame rate. I will try reading in 256 bytes at a time. I hope that works… I also tried using 6 buffers with 600kB each. N updating each buffer once the buffer is used. Bt it doesn’t help

And @ Gus. I will change it once I get to a computer. I’m using my phone at the moment

Another question? which is faster? Reading from a usb or an sd card? Cos if I use a usb n get faster speeds then it might work…

I’ve been asking the question to improve SD read/write speeds a lot of times to GHI. But again that was for EMX, do you have an idea of what the current readspeed is with managed code on the Hydra?

I should take a look at the source code of the Hydra firmware on this matter. Maybe there is a possibility to fix the bottleneck and build your own firmware? I do not know if the firmware can be compiled with GCC however.

If buffering doesn’t help perhaps its your native code. Check your frame rate for each buffer or make one large buffer and pass that through. If the frame rate is acceptable then read is your issue. If not the problem is in your code, video size or CPU speed not reading.

I think its my native code that’s the problem. Just did some debugging and it its taking long to process the data in rlp . The buffers are getting updated properly . Jus need to sort the code out.

@ WouterH

is it possible to give me a few hints to create the RLP sd card library. i have downloaded Chans fat file system and i understand most of the operations. How do i go linking the fat file system to the hydra? Please help me with any info.

Ok so I figured out that its not really the reading of the sd card problem… Bt mostly the thread priorities that is slowing the display… Soo I’m not sure what to do now

The Hydra firmware can be compiled with GCC the only thing that needs fixing is the scatter file XML config. I will be back in Cyprus over the weekend and I can share the file if anyone is interested.

@ taylorza - Would it be possible to descibe the used toolchain and how to setup this for building? I’m interested in building my own Hydra firmware. Maybe you can add a Wiki item. Thanks.

1 Like