This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK 15.3 USB MSC can not modify file in pc.

Hi.

    I use SDK15.3 (PCA10056 NRF52840) USB MSC example.

    i can enumerate disk, creat file and delete file. but  i can not edit file. 

    When I edited the file, re-plugged the USB and opened the file I just edited again. pc display file does not exist. The content I just edited does not exist.

    

    wait for help.  thank you.

    

  • Hello, 

    The USB MSC example should work "out of the box". Have you tried to debug while running the example? Are you getting any type of error message? 
    What happens when you press any of the following (from the USB MSC example docs)? 

    • Button 1 creates a randomly named file in the root directory.
    • Button 2 lists the root directory.
    • Button 3 creates a file system (equivalent of the format command).

    Kind regards,
    Øyvind

  • Looks like you used the example that just puts the data in the controller's RAM (G: is only 170KB).

    This will of course vanish when the power is turned off (or the MCU was otherwise reset).

  • Thank you for reply.

    i do not get any error message when i running the example.  and three buttons function normally.

    my  question is similar to [FATFS] FA_OPEN_APPEND destroy first file content 

    I have modified the bug as prompted. 

    However, after I modified the file, I still can't read the file normally after re-plugging the USB.

    wait for reply. thank you.

  • Thank you for reply.

    i  puts the data to the extern flash.

    Looking forward to further reply. thank you.

  • Hello again, 

    I've been testing and digging more into this. It seems that this a known bug which has been reported internally. See this thread.

    If you connect to your board via a terminal, you will get the output of the example similar to this:

    [00:00:00.000,000] <info> app: Initializing disk 0 (QSPI)...
    
    [00:00:00.000,000] <info> app: Mounting volume...
    
    [00:00:00.000,000] <info> app: 
    
    Listing directory: /
    
            0  000041C6.TXT
    
    Entries count: 2
    
    Creating random file: 000041c6.txt ...done
    
    [00:00:00.000,000] <info> app: USBD MSC example started.
    
    Creating random file: 0000167e.txt ...done
    
    [00:00:00.000,000] <info> app: 
    
    Listing directory: /
    
            0  000041C6.TXT
    
            0  0000167E.TXT
    
    Entries count: 3
    
    [00:00:00.000,000] <info> app: USB power detected
    
    [00:00:00.000,000] <info> app: Un-initializing disk 0 (QSPI)...
    
    [00:00:00.000,000] <info> app: USB ready
    
    [00:00:00.039,581] <info> app: USB power removed
    
    [00:00:00.039,581] <info> app: Initializing disk 0 (QSPI)...
    
    [00:00:00.039,581] <error> app: Disk initialization failed.
    
    [00:00:00.039,581] <info> app: USB power detected
    
    [00:00:00.039,581] <info> app: Un-initializing disk 0 (QSPI)...
    
    [00:00:00.039,581] <info> app: USB ready
    
    

    The issue is connected to the error "Disk initialization failed". Not sure when to expect a fix. I have asked the responsible team and will get back to you.

    Kind regards,
    Øyvind

Related