Question
Using f_write in a loop to write multiple chunks of data, doesn't seem to work
I'm using the following code:
//100KB buffer
uint8_t testBuffer[100000];
for(int i = 0; i < 100000; i++)
{
//Fill buffer
testBuffer[i] = 'U';
}
BSP_LED_On(LED_BLUE);
for(int z = 0; z < 5; z++)
{
res = f_write(&MyFile, testBuffer, sizeof(testBuffer), (void *)&byteswritten);
}
BSP_LED_Off(LED_BLUE);
//Check write OK
if((byteswritten == 0) || (res != FR_OK))
{
BSP_LED_On(LED_RED);
Error_Handler();
}
else
{
f_close(&MyFile);
}To test writing 5 100KB chunks to the SD card.
Regardless of the size of each chunk, the first one seems to write fine, then after that, nothing.
I've tried a short delay between chunks but it doesn't seem to help.
Do I have to flush the buffer or anything like that inbetween f_write commands?
