-5

I can't read uint data(in text file) from sdcard which has been written from stm32 adc. I am able to write data to sd card but weird symbols appear when I open txt file in my latop.

I am using SDIO and FATFS

1 Answers1

-1
if(f_mount(&myFAT,SD_Path, 1)==FR_OK)
    {   
        HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_14);
        f_open(&myFile, "test1.txt\0",FA_WRITE|FA_CREATE_ALWAYS);
        for(int i=0; i<1000;i++){
        sprintf(msg,"%hu\r\n",data[i]);
        f_write(&myFile,msg,10,&byteCount);
        }
        f_close(&myFile);
        HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_15);
    }
  • I just created a buffer with the size 1000 to write my ADC values and in a for loop converted it to char and then wrote to SDcard. For me, it is working properly. – Elman Karimli Nov 28 '17 at 13:27