Hi, I have recently acquire an nrf52840 development board to prototype a usbd msc. With the example provided in sdk17.02-USBD_MSC, for saving every 1000 frames of data, 100 frames of data are lost.
The flash chip is mx25r6435.
// here saving_num = 1000.
if((saving_count < saving_num)&& writing_flag)
{
char temp_value[100];
sprintf(temp_value,"%d",time_count);
memcpy(temp_value + strlen(temp_value),ENDLINE_STRING,sizeof(ENDLINE_STRING));
NRF_LOG_INFO("%s",temp_value)
ff_result = f_write(&file, temp_value, strlen(temp_value) - 1, (UINT *) &bytes_written);
if (ff_result == FR_OK)
{
NRF_LOG_INFO("%d bytes written.", bytes_written);
}
else
{
NRF_LOG_INFO("writing failed");
}
writing_flag = false;
saving_count = saving_count +1;
}
if (saving_count == saving_num)
{
saving_count = saving_count +1;
ff_result = f_sync(&file);
if (ff_result == FR_OK)
{
NRF_LOG_INFO("sync success.");
}
}

