Question
STM32 + SD Card
Posted on December 27, 2012 at 12:27
Hi,
I am trying to initialze my SD card,for some reason i cannot create\open a file,this problem raises the following question : am i obligated to use the fatfs library f_open, or can i use the regular fopen\ifstream etc... to work with files ? .. Here attached a code snippet of what ive done :
FATFS MSD_fatfs;
#include ''stm32f4xx.h''
#include ''stm324xg_eval.h''
#include ''stm324xg_eval_sdio_sd.h''
#include ''ff.h''
int
main(
void
)
{
if
(SD_Init() == 0)
{
if
(SD_GetStatus() == 0)
{
if
(f_mount(1, &MSD_fatfs ) == FR_OK )
{
FILE *fp_ = fopen(
''1:/mm.txt''
,
''w''
);
if
(fp_!=NULL)
{
fclose(fp_);
}
}
}
}
}
Thanks
Michael