2017-10-16 02:58 AM
Hi all,
I created a project in CubeMX for a STM32F429IGtx with SDIO and FatFs. Clock at 180 MHz,
The example works fine in 1 bit mode, but when I switch to 4 bit mode by adding the define 'BUS_4BITS'
it does not work and f_write returns an FR_DISK_ERROR. Have switched to DMA, seems to work only with DMA,
but not reliably.
I found an example: STM32Cube_FW_F4_V1.16.0 -> STM324x9I_EVAL that works fine in 4 bit mode.
I have tried to set the pullups in the CubeMX example, but nothing works. I can not see whats really the difference
exept a different initialization order.
Does anyone have an idea? What are the pitfalls with SDIO in 4 bit mode?
Best regards
Andreas
2017-10-17 02:56 AM
Try first disable FATFS, and check if HAL_SDIO_Write() and HAL_SDIO_Read() are working properly.
Lower down clock speed, check your waveform of Data pins, also check your hardware....
2017-10-31 12:14 AM
I am facing the same issue for Stm32f103re. It seems the CubeMX does not generate the correct configuration for 4 wire wide bus SD. Also manually changing of line 'hsd.Init.BusWide = SDIO_BUS_WIDE_1B;' to 'hsd.Init.BusWide = SDIO_BUS_WIDE_4B;' in 'MX_SDIO_SD_Init()' makes FATFS functions halted.
2017-10-31 07:31 AM
The code initializes the card at 400 KHz and 1-bit, reads the card geometry data, and then later negotiates higher speed and wider buses.
I'd try the SDIO examples from the SPL, and confirm if those work properly in your circuit.
2017-11-02 03:40 AM
Hi Clive One,
the description of the SDIOCLK clock devide factor says 'It is advised to keep the default ClockDiv value (0) to have a maximum SDIO_CK frequency of 24 MHz.'
Maybe this is the problem, that it is too fast at the beginning? But the code in the STM324x9I_EVAL-Example works
in the same way...
Weird...