Go Down

Topic: SD card read/write with Arduino (Read 111 times) previous topic - next topic



Hello everyone
Does anyone know to make the raw program write in blocks smaller than 512?


512 bytes is the sector size of the device.

Why do you want to write smaller blocks?


I'm trying to sample a guitar signal and store it to the SD card. It looks like when the Arduino writes the recorded signal to the SD card it takes up some time. Which means that the input signal gets ignored for awhile. I was hoping that if i could shorten the number of bytes being sent to the card it wouldn't ignore the sinput signal to a point that it wouldn't be noticed by the user. If this is to vauge I will gladly go into more detail later. Thanks for taking interest  ::)


I did find that I'm not setting high speed mode  :-[

This might improve matters.

Another thing you might consider is setting up a 'double buffer' system, where you're reading values into one buffer under interrupt control whilst writing the other. You can tune the sampling rate so that you get a consistent period.

Another thing to do might be to break the 'write sector' function so that you can write bytes at a time... You'd have to re-send a command every 512 bytes or so, but that shouldn't take long - there's a latency of about 12 bytes as the write is finished up, then the next sector is primed.

Sorry if that all sounds quite complicated - but it has to be. You don't get something for nothing on a microcontroller  :P

Go Up