2023-11-09 07:01 AM - edited 2023-11-09 05:16 PM
I have connected microsd by SDIo to STM4Disc1 board. I am using SD 4 bit.
I see on STM forums there is a bug and needs to set 1bit in MX_SDIO_SD_Init
so I changed to hsd.Init.BusWide = SDIO_BUS_WIDE_1B and reduce SDIO CLK by 192 factor.
I am able to execute FATFS_LinkDriver, f_mount & f_mks function runs successfully but f_open function always fails...
I tried to create new file using f_open function.
f_open(&MyFile, "TESTING.TXT", FA_CREATE_ALWAYS | FA_WRITE )
I also tried to open already exiting file but it also fails.
f_open(&MyFile, "test123.txt", FA_READ)
On seeing FRSEULT , I see FR_NOFILESYSTEM
2023-11-10 05:10 AM
Hello @Nico3
First let me thank you for posting.
In fact this is a known issue which is tracked internally.
Waiting for a permanent solution I advise you to go ahead and configure the bus width in CubeMX to1bits.
Then in the generated code for the MX_SDIO_SD_Init function add the following code in the user code section 2:
if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK) { Error_Handler(); }
BR,
Semer.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-11-10 06:34 AM
bus is set to 1 bit. but on executing below function, it goes to error handler
if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK) { Error_Handler(); }
2023-11-13 12:18 AM
I think there is bug in lower level bugs.. DMA looks mandatory. I enable it with SDIO IRQ, I can run now with no issues.