Keith Kolmos


Discussion created by Keith Kolmos on Jan 23, 2011
Latest reply on Feb 16, 2011 by David Veerman

So I finally got the USB-Mass Storage Device Demo project running on my own target hardware (rather than the demo board).


The CMX FFS THIN system (that came with the demo) seems to be working pretty good.  I can write data out to the USB drive I have attached.


However, I have run across a bit of a snag. 


The first thing I do after everything is setup and working correctly is write out the Configuration Data (for my system) that I have stored in a I2C EEPROM on board into a CSV file out on the USB stick.  That works great.  I then close that file (with f_close(file1)) and it does not return an error code.


But then I want to write some data to a second file.  If I try to do an f_open(file2) of the second file, it will not open.  EVER. 


I understand that the CMX THIN that Freescale gives with this demo is limited to 1 file being open at a time, but I have closed the first file. 


Yes, I have tried reversing the order (open the second file first) and whatever the FIRST file I open - that write happens succesfully.  But the second file opened returns a NULL pointer when I call f_open(file1).

I have stepped through the code and I can confirm that I am calling f_close(file1) and it is not returning an error.


The odd thing is, if I stick the USB stick into my PC, the file2 is on the USB stick with a 0 byte size. 


Anybody have any thoughts?