define BUS_4BITS 1
define SDIOUSESDMA 1
I generated only one task, SDcard write, which write 400byte with 50hz the task is as follows: void SDCARDWRITETask(void * pvParameters) { uint32_t PreviousWakeTime = 0; SDcardInit(); SDcardSetFileName(“FDR”,”/FDR”); for(;;) { HALGPIOWritePin(GPIOG, GPIOPIN6,GPIOPINSET); //pin high PreviousWakeTime = osKernelSysTick();SDcardWrite(ucFileName, SDCARDBuffer, sizeof(SDCARDBuffer)); //wirte 400byte HALGPIOWritePin(GPIOG, GPIOPIN6,GPIOPINRESET); // pin low vTaskDelayUntil(&PreviousWakeTime, 20/portTICKPERIOD_MS ); } } PG6, the pin is high at start, will be low state at the end of the cycle to check the processing time SDcard Write the contents of the function is as follows: void SDcardWrite(uint8t * filename, uint8t *buf, uint16t size) { FFFILE *pxFile; int32t lItemsWritten; static int32_t cnt = 0;
pxFile = ff_fopen( (char const*)filename, "a" ); // open the file
if ((pxFile) != 0){SDCARD_STATUS.SD_IsFileOpened = SD_FILEOPENED;}
memset( buf, 0, size);
snprintf( (char*)(buf + 5), (size-5), "FDR_%020d", cnt);
cnt++;
*((buf + 0)) = 'S';
*((buf + (size-3))) = 'E';
*((buf + (size-2))) = 'r';
*((buf + (size-1))) = 'n';
lItemsWritten = ff_fwrite( buf, size, 1, pxFile ); // write 400 byte
SDCARD_STATUS.SD_FileWrittenSize = lItemsWritten*400;
ff_fclose( pxFile );
SDCARD_STATUS.SD_FileAffordSize = SDcard_Capacity_MB(pxDisk); // check SDcard Capacity
}
SDCARD WRITE Task oscilloscope results confirmed cases unexpected time length occurred during the test, I set it up 50hz to write 400byte but, sometime it takes 200~250ms oftenly
even if I change the length of bytes the problem still occurred
Why does this problem happen?
is there any chance I can write 512bytes with 50hz?
or is there any limitation of bytes or frequency for SDcard writing?