Author Topic: USB MSD data corruption MK20DX256VLH7  (Read 12119 times)

Offline Alex1982

  • Newbie
  • *
  • Posts: 7
    • View Profile
USB MSD data corruption MK20DX256VLH7
« on: September 24, 2024, 08:27:51 AM »
Hello Mark,

Some customers are experiencing issues with USB-MSD firmware updates (flash drive emulation mode). The MK20DX256VLH7 appears as a drive, as expected, but it shows a file with a seemingly random name and a size of over 3GB.

Attached are screenshots from two different customers illustrating the issue.

Have you encountered this type of problem before, and can you recommend any solutions to resolve it?

Thank you!

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3243
    • View Profile
    • uTasker
Re: USB MSD data corruption MK20DX256VLH7
« Reply #1 on: October 06, 2024, 01:44:40 AM »
Hi

Sorry that I didn't see this post until now.

I don't know why this would happen but it is due to the file object, which is written after loading a new FW, being corrupted. Potentially it was written correctly but later overwritten, causing some values to be modified.

Attached is the latest version of usb_device_loader.c which was modified with this change quite some time ago:
16.01.2017 Check valid file and display for delete if random data    {33}

You will see that it uses
fnCheckFileObject() to verify that the file object is not corrupted and will, if it finds it to be bad, display a file called "UNKNOWN.BIN" with a size matching the application area (instead of trying to display the content according to teh fiel object itself).

This allows the user to do a delete of the file (cleans the application area) and then load the FW (again).

The problem with a corrupted file object can also be that multiple strange files of seemingly random lengths are found and it may otherwise not be possible to delete them to clear it up. This check and the "UNKNOWN-BIN" method ensures easy recovery.

This doesn't help with a source of corruption itself though.

Regards

Mark