nrf52840 usb msc qspi slow writing speed and losing frames

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.");
       }
  }

Parents
  • Hi again

    As mentioned in my last reply, our QSPI peripheral is not really suited for writing a bunch of data onto an external flash in quick succession.

    Either way, I think you should add some checks to check the return values of various functions to get a better picture of what functions are taking this extra time during some writes. It could be that it takes some extra time whenever a page is full or some other functions are also done in the time between the timer begins and the data is written and trigs the diff time.

    Best regards,

    Simon

Reply
  • Hi again

    As mentioned in my last reply, our QSPI peripheral is not really suited for writing a bunch of data onto an external flash in quick succession.

    Either way, I think you should add some checks to check the return values of various functions to get a better picture of what functions are taking this extra time during some writes. It could be that it takes some extra time whenever a page is full or some other functions are also done in the time between the timer begins and the data is written and trigs the diff time.

    Best regards,

    Simon

Children
No Data
Related