2016-08-16 03:16 AM
hi,
i am trying to do a data logger using FAT with sd card. in the below code trying to write in sd card with 100ms interval, the code has write into sdcard at only one time. latter it has gone to error
/*##-1- Link the micro SD disk I/O driver ##################################*/
if
(FATFS_LinkDriver(&SD_Driver, SDPath) == 0)
{
/*##-2- Register the file system object to the FatFs module ##############*/
if
(f_mount(&SDFatFs, (TCHAR
const
*)SDPath, 0) != FR_OK)
{
/* FatFs Initialization Error */
Error_Handler();
}
else
{
/*##-3- Create a FAT file system (format) on the logical drive #########*/
/* WARNING: Formatting the uSD card will delete all content on the device */
// if(f_mkfs((TCHAR const*)SDPath, 0, 0) != FR_OK)
{
/* FatFs Format Error */
Error_Handler();
}
// else
{
while
(1)
{
/*##-4- Create and Open a new text file object with write access #####*/
if
(f_open(&MyFile,
''STMTXT''
, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)
{
/* 'STMTXT' file Open for write Error */
Error_Handler();
}
else
{
/*##-5- Write data to the text file ################################*/
res = f_write(&MyFile, wtext, bytesread, (
void
*)&byteswritten);
// while(byteswritten != bytesread)
{
BSP_LED_Toggle(LED1);
// HAL_Delay(1000);
}
f_close(&MyFile);
HAL_Delay(100);
}
}
{
}
what is the way to make a data logger using STM32F746G.disco baord
regards
Rajesh
#stm32 #usb #fatfs #no-hablo-hal #fr_not_ready #stm32f746g-disco-
2016-09-08 04:18 AM