USB MSC code, windows not able to access drive.

I am using the USB MSC code in my project. The project works fine and I am able to see the file system mounted and file being created in the logs. When I plug in the device into my laptop, I can see the device as a drive. However, when I click to access the drive, it asks me to format the drive and I am not able to view the contents of the drive. What might be causing this issue?

Parents Reply
  • Sorry my SDK is 17.0.2 only. I misread it . what should be the configuration of the flash chip inside this function if my flash is 4Mbit?

    The below config is taken from example code. 

    static const nrf_serial_flash_params_t m_sflash_params[] = {
     { /*MXIC MX25R6435F*/
     .read_id = { 0xEF,0x60,0x17 },
     .capabilities = 0x00,
     .size = 8 * 1024 * 1024,
     .erase_size = 2 * 1024,
     .program_size = 256,
     }
    };

    And what should be the Block size,MSC_WORKBUFFER_SIZE & format size for 4Mbit flash?

Children
  • Hi Snehal

    The .size set by default is for a 64Mbit flash (8 MByte). 1024*1024 = 1 MB, so you can multipy that with how many MB the used flash device is. Since 4Mbit is the same as 0.5 MB, the .size should be set to 0.5 * 1024 *1024, or 512 * 1024 simplified. MSC_WORKBUFFER_SIZE is the buffer that gets actual payload from the USB. This buffer is subdivided into 2 smaller buffers and they should have the size of a single block.

    Best regards,

    Simon

  • Thanks for your reply.  So that means the .size will be set to  524288. Now for setting MSC_WORKBUFFER_SIZE, how can we determine the size of a single block?

    If we set the config as follows:-

    NRF_BLOCK_DEV_SPI_DEFINE(
    m_block_dev_spi,
    NRF_BLOCK_DEV_SPI_CONFIG(
    512,
    NRF_BLOCK_DEV_SPI_FLAG_CACHE_WRITEBACK,
    NRF_DRV_SPI_DEFAULT_CONFIG
    ),
    NFR_BLOCK_DEV_INFO_CONFIG("Nordic", "SPI", "1.00")
    );

    then the block size will be 512?? 

    So MSC_WORKBUFFER_SIZE should be set to 1024 right? 

    But even after doing these settings I am still not able to access drive through laptop.

  • I have also added some logs in the usb msc drivers to check for any errors. I have attached the log file here. Can you please help me debugging it?

    RTT-DEBUG1.log

Related