Skip to main content
mostafa z
Associate II
May 15, 2018
Question

Problem in STM32CubeF4_21 usb mass storage sample

  • May 15, 2018
  • 3 replies
  • 1098 views
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?
    This topic has been closed for replies.

    3 replies

    Tesla DeLorean
    Guru
    May 15, 2018
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    mostafa z
    mostafa zAuthor
    Associate II
    May 15, 2018
    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!
    Tesla DeLorean
    Guru
    May 15, 2018
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..