AnsweredAssumed Answered

STM32 + SD Card

Question asked by melamud.michael on Dec 27, 2012
Latest reply on Jan 8, 2016 by Clive One
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 :

01.    FATFS MSD_fatfs;
02. 
03.#include "stm32f4xx.h"
04.#include "stm324xg_eval.h"
05.#include "stm324xg_eval_sdio_sd.h"
06.#include "ff.h"
07. 
08.int main(void)
09.{  
10.    if(SD_Init() == 0)
11.    {
12.        if(SD_GetStatus() == 0)
13.        {
14.            if (f_mount(1, &MSD_fatfs ) == FR_OK )
15.            {
16.               FILE *fp_ = fopen("1:/mm.txt","w");
17.               if(fp_!=NULL)
18.               {
19.                   fclose(fp_);
20.               }
21.            }
22.        }
23.    }
24.}


Thanks
Michael

Outcomes