2019-01-29 05:03 AM
This is the snippet of the code that is showing me the error. It has been written just above the while(1) function.
Also, I have attached the whole code in the attachments.
FATFS myFATFS;
FIL myFILE;
UINT testByte;
if (f_mount(&myFATFS, SDPath, 1) == FR_OK)
{
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
char myPath[] = "WRITE1.TXT\0";
f_open(&myFILE, myPath, FA_WRITE | FA_CREATE_ALWAYS);
char myData[] = "HELLO WORLD\0";
f_write(&myFILE, myData, sizeof(myData), &testByte);
f_close(&myFILE);
HAL_Delay(1000);
f_mount(0, SDPath, 1);
}
Kindly help
With regards
Siddharth Soni
2019-01-29 05:42 AM
Perhaps then it is not related to the card, but perhaps the card detect pin on the socket or that the SDIO/SDMMC layer hasn't been properly initialized.
Focus on the lower level code, not the high level stuff.
2019-01-29 09:17 PM
No SD card is not getting mounted. I just have these two so I mentioned that.
I have attached the code too. Can you please go through it and let me know where the fault is and why am I not able to mount the card? According to me, this code has no fault as I myself have used it from a youtube tutorial and it worked well in the tutorial. I am pretty new to STM32 so might not be able to figure out if there's something wrong in the code or not.
P.S. - I am using STM32F446RE Nucleo board and this is the link to the tutorial video just for your reference: https://www.youtube.com/watch?v=Y5UMTGQDmog&t=49s
Kindly help.
Thanks
Siddharth Soni