nRF52840 SDK16 - USB MSC Example - What is happenning when the external flash memory get full?

Hi everyone,

I am using the nRF52840 DK and I am experimenting with the USB MSC example. My purpose is to record data from an IMU device and store them in files. Then to read the files and transmit the data over bluetooth to the central.

I have two questions

1. Is there any limitation regarding the file size?

2. What is happening when the memory is getting full?

Thanks in advance

Nick

  • Hi Nick

    1. The fatfs file system library used in the USB MSC example uses fat32, which has a file size limit of 4GB. 

    2. At some point you will not be able to create any more to files, and the file interface will return an error. 

    Best regards
    Torbjørn

  • Hi ovrebekk and thank you for your responce,

    At some point you will not be able to create any more to files, and the file interface will return an error. 

    Do you know what error it will return? I have to handle this error

  • Hi Nikos

    I did some testing to see what would happen, and it seems you don't get an error, but you will see that you are not able to write more bytes into the file. 

    UINT buffer_length = 64;
    UINT bytes_written;
    ff_result = f_write(&file, data_write_buffer, buffer_length, &bytes_written);
    if(bytes_written < buffer_length || ff_result != FR_OK)
    {
        NRF_LOG_ERROR("File write error: bytes %i, result %i");
    }

    If the f_write function reports less bytes written than you ask for it means there is no more room for data on the drive. 

    Best regards
    Torbjørn

  • Thank you for your effort ovrebekk,

    Just for reference, I've just found that your procedure to check full disk also described here

Related