How fast can a Prop write to a FAT32 SD Card?
FlyingFishFinger
Posts: 461
Hi-
We've been looking for a relatively easy way to log CAN data to an SD card. CAN specifies that one can run it at up to 1Mb/sec, but our CAN Architect tells me we won't be running any faster than 500Kb/sec, max.
Is there any way the existing drivers (E.g FSWR, Kye's Implementations) can log this fast? If not, is there a good way of logging CAN data this fast?
Thanks
Rafael
We've been looking for a relatively easy way to log CAN data to an SD card. CAN specifies that one can run it at up to 1Mb/sec, but our CAN Architect tells me we won't be running any faster than 500Kb/sec, max.
Is there any way the existing drivers (E.g FSWR, Kye's Implementations) can log this fast? If not, is there a good way of logging CAN data this fast?
Thanks
Rafael
Comments
For example, when a write buffer is full, the SD card's processor has to write it to where it thinks that sector is located. There's a limit on how many times a sector can be written, so the processor may decide to write that sector to a different part of the SD card and it has to go back and copy the physical sector (which may contain quite a few logical sectors) to a new place on the SD card and update some markers to show where that physical sector resides. This whole process may take 10s of milliseconds or more.
One way to handle this is to allocate a fixed logging file on the SD card larger than the largest log file you'll need or perhaps a series of fixed logging files that, together, provides enough storage. You'd use FSRW to build a table of absolute sector addresses and sizes for these files and use a low-level sector write routine that accepts absolute sector addresses to write the log data. You could modify either Kye's low-level routines or the low-level FSRW routines to run in their own cog writing from a large pool of sector buffers. I know the FemtoBasic low level SD card routines can do this and I'm sure any of the others can be made to work this way and they'd be faster.
You'd need enough buffers for a sizable fraction of a second of log data.
Jonathan
Due to how my file system works currently you can't just switch out the block driver and hope to get much faster write speeds.
800K BYTES? That is a lot. Did you mean bits? Either way, that seems sufficient for our purposes.
Thanks!
Rafael
Jonathan
Is that test program still up to date?