AnsweredAssumed Answered

MFS behavior different for different flash drive manufacturers?

Question asked by Nathan Kohler on Jul 17, 2014
Latest reply on Jul 18, 2014 by soledad

I am building an application based off the mfs_usb example in MQX 4.0.1 for the 52259evb.  My application is basically as follows:

 

It is crucial that I sample data every 20ms.  It is not possible to sample the data, write it to file, then flush the file in 20ms, so what I do is I have two tasks, and two buffers.  A sample task/buffer, and a write task/buffer.

 

I grab data samples every 20ms, and stick them in a buffer that can hold up to 400ms worth of sample data.  After 400ms (20 sample points), I swap the pointer for the read/write buffers, and I initiate a file write of the data.  While the write is occurring, I then continue sampling data in the other task into the other buffer.

 

So basically, every 400ms I have an fprintf() of approximatly 500 bytes followed by an fflush().  After 10,000 entries in a file I close it and open a new file.

 

So far I have tested with 3 different USB flash drives:

 

1)  The Freescale flash drive (128MB) that was included with the 52259EVB.  This one is rock solid.  I can run for days without issues.

2)  PNY 16GB.  After several hours of running without issue, I just get an error that it can't open a file.  It's like the flash drive just disappeared.  No detach or anything.  Rebooting fixes it.

3)  A Swissbit 300MB drive.  After several hours of running without issue, I get a DETACH mid write.  Then I get an unhandled exception because it tries to write to the file system again.  Rebooting fixes it.

 

I've checked stack sizes, and it doesn't look like I'm going over 50% usage in any task.

 

Any ideas I get unstable behavior from different drives?  Is there something unique about the Freescale flash drive?  Is there any reason to try MQX 4.1?  I didn't see anything in the release notes that would suggest any MFS improvements.

Outcomes