I am having problems with logging data on a thumb drive. I wrote under another topic yesterday and was suggested to create a new one so here it is. Just a summary of what I am trying to do accompanied with the actual code block.
- Acquire sensor data using a custom sensor board. Total packet size is 62 bytes and packet update rate is 50 Hz.
- Send the data to FEZ domino via SPI. Here I am sending the 62 byte packet every 20ms. No problems in receiving it.
- Accumulate the packets for a second. This makes the total data size to 3100 bytes. I have a circular buffer implemented in FEZ. Its a 6200 bytes array with two pointers one for writing and the other for reading. Its a well tested logic and I have done detailed debugging. There is nothing wrong over here either.
- Once I have more than 25 packets i.e. 1 sec of data, I write it onto the USB thumb drive. This is where the problem occurs. If I comment the line of code where I send 3100 bytes to USB thumb drive, every thing works fine. I don’e get any packet miss issues. Again I have done detailed debugging and found no packet miss issues. But when I uncomment this line of code, FEZ just doesn’t seem to be able to keep up. I have pasted the code chunk performing the above mentioned tasks.
- One more thing. I have checked two different USB thumb drives even an SD card (as SD card has a 4bit interface so I thought this will help) but no luck.
I am not saying that what the designers are claiming (500,000 bytes per second) is incorrect. I am sure they performed a thorough benchmarking before claiming this. There is something wrong with my coding. Any suggestions/ advice will be appreciated.