Hi,
Problem: Not able to re-open after f_close. Seems to work fine without ADC function.
Description: I have done the following:
fresult = f_mount(0, &g_sFatFs);
while(1)
{
if (SW1 == PRESSED){
// Open the file & change filename if exists
do{
sprintf(g_cFilePath,"/File-%d.csv",fileNum);
g_cFilePath[0]=0x2F; //to ensure the blackslash is written into the filename string
fresult = f_open(&g_sFileObject, g_cFilePath, FA_CREATE_NEW|FA_WRITE); //always create new file if not exists
fileNum++;
}while(fresult == FR_EXIST);
// start reading of ADC inputs by the use of ADC interrupt
}
else if (SW2 == PRESSED){
// Stop ADC interrupt
for(i = 0 ; i < LENGTH ; i++)
{
memset(ccNum,NULL,sizeof(ccNum));
sprintf(ccNum,"%u,%u\n",ui16CH1Value[i],ui16CH2Value[i]);
fresult = f_write(&g_sFileObject, ccNum, sizeof(ccNum), &bw);
}
else if (SW3 == PRESSED){
f_close(&g_sFileObject);
}
}
I'm only able to write the data into the SD card once and the very next time, the fresult of f-open shows "FR_NOT_READY". Why is that so?