cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in STM32CubeF4_21 usb mass storage sample

mostafa z
Associate II
Posted on May 15, 2018 at 12:26

Hi

I use mass storage sample from STM32CubeF4 ver 1.21 pakage

When I format a partition with a NTFS system file and copy a large file to it, if device resets during the copy, the partition is corrupted and requests formatting. in FAT32 an extFAT i dont have this problem!

Has anyone ever encountered this problem? Please guide where is the problem?
3 REPLIES 3
Posted on May 15, 2018 at 12:47

Not quite sure what it is writing too in this context.

As a starting point you should perhaps step back and validate that the Read/Write to the block storage media is working properly, ie that it consistently/correctly reads back the right data all the time, and that it reads back what was written. This can be quite an involved test if you haven't done mass storage or file system work before. But start with the block side, as the file system will go pear shaped if the structures don't get saved properly and things get corrupted.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 15, 2018 at 14:28

Thank you for your reply

The given example works with the FAT32 and exFAT file system. This problem occurs only in the NTFS file system!
Posted on May 15, 2018 at 14:42

I'm not sure why NTFS should be specifically different. It puts structures in the middle/end of the media, but basically issues will be with how it reports size (READ CAPACITY) and how the READ/WRITE, and support of multiple sectors, is implemented. Most frequently the inability of the mass storage devices to return the correct blocks with the correct content, is at the root of critical failures.

I would instrument the read/write routines (print block address/size info via SWV or USART) so they output block and size information, and during initial bring up do a CRC across individual sectors so you can prove the data written is the same as the data returned later.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..