2020-06-10 10:30 AM
Hi everyone,
Sorry for this “Error while parsing Rich Text Content�?, I got an error when publishing. I can't share the whole file.
Problem :
> Even the card is present or not, The SD card is mounted .
> I can’t write a file to the sd card.
Context :
I read a lot of books, documentations and tutorials, I can’t find a way to make it work.
From the STM IDE debugger, I can’t get rich errors as I find with Python or Javascript. This is why I’m asking help. Except with printf but this is only a personal comment to my terminal. What I mean it's... I cannot I have a feedback from a function error. I only can track variable value. I spend a lot of time on it but I cannot solve this basic issue.
Technical specifications :
Mac OS - 10.15.4
CubeMX - 5.6.1
STM32 IDE - SDIO / FATFS
SD Card Board :
code
extern char SDPath[4]; /* SD logical drive path */
extern FATFS SDFatFS; /* File system object for SD logical drive */
extern FIL SDFile; /* File object for SD */
FIL myFile;
UINT myBytes;
if(f_mount(&SDFatFS, SDPath, 0) == FR_OK)
{
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_SET);
if(f_open(&SDFile, "F7FILE2.TXT", FA_CREATE_ALWAYS | FA_WRITE) == FR_OK)
{
HAL_GPIO_WritePin(GPIOD,GPIO_PIN_13, GPIO_PIN_SET);
char myData[] = "Helllo ";
if(f_write(&SDFile,myData, sizeof(myData), &myBytes) == FR_OK)
{
HAL_GPIO_WritePin(GPIOD,GPIO_PIN_15, GPIO_PIN_SET);
}
f_close(&SDFile);
}
}
else
{
HAL_GPIO_WritePin(GPIOD,GPIO_PIN_14, GPIO_PIN_SET);
}
Cube MX set-up :
1 - pin
2 - FATFS configuration :
Only Physical drive were changed.
3 - SDIO set-up :
Please ask if you need more insight.
Thank you,