Question
How to configure 4-bit SDIO with DMA using STM32CubeMX?
How to configure 4-bit SDIO with DMA using STM32CubeMX, to write to an SD card?
FW is running on an STM32F103.
I am trying to set up an SDIO interface with DMA for an SD card using STM32CubeMX.
The issue I am having is that I am unable to write to the SD card.
I can read from it just fine, but trying to write to it always fails.
Not quite sure what the issue is but here is some more information:
- I've found that a Transmit-FIFO-underrun flag is set when attempting to write.
- Could be related to the clock settings. The MCU is running at 8MHz, and the SDIO line is at 4MHz (divide bypass disabled and divide factor set to 0).
- Could be due to priority settings for DMA and SDIO. Tried setting the SDIO priority is set to 0, and the DMA channel to high, but that did not help. There is another high-priority DMA channel in the system, used by an ADC.
- The processor I'm using is the STM32F103, for which CubeMX only gives me one DMA channel as an option, which I've set to be Peripheral to Memory (the other options being Memory to Peripheral and Memory to Memory). Not sure whether that has anything to do with it. Setting it as Memory to Peripheral right before a write seems to fail as well.
Any help would be greatly appreciated.
-Best
