STM32 F4: SDIO & SPI1 on the same DMA stream

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
Abhishek
Posts: 266
Joined: Wed May 23, 2012 3:15 pm

STM32 F4: SDIO & SPI1 on the same DMA stream

Post by Abhishek »

Hello,

I faced a problem while building a UI application using the ChibiOS/GFX library, whenever I used the touchscreen [the TSC IC is connected on SPI1], I couldn't read from the SD Card as long as the touch screen was on. The application was freezing randomly, and while debugging, I found that FS_DISK_ERR was occurring. As long as I was not using the touchscreen, I could read from the SD card fine.

I later traced the problem to both the SPI1_TX and SDIO sharing the same DMA stream STM32_DMA_STREAM_ID(2, 3).

The issue was resolved, in my case, by changing in sdc_lld.h:

Code: Select all

#define STM32_SDC_SDIO_DMA_STREAM           STM32_DMA_STREAM_ID(2, 3)

to

Code: Select all

#define STM32_SDC_SDIO_DMA_STREAM           STM32_DMA_STREAM_ID(2, 6)


Regards
Abhishek
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 F4: SDIO & SPI1 on the same DMA stream

Post by Giovanni »

Hi,

Assertions enabled would have revealed that, it is always a good idea to keep debug options at TRUE while developing.

Giovanni
alexblack
Posts: 277
Joined: Mon Sep 24, 2012 3:52 pm
Been thanked: 33 times

Re: STM32 F4: SDIO & SPI1 on the same DMA stream

Post by alexblack »

Hi,
This is a common problem with limited resources. I was very annoyed at the STM, as before designing the device I has to carefully choose which devices to use which functions to avoid conflict. No flexibility!
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: STM32 F4: SDIO & SPI1 on the same DMA stream

Post by Tectu »

alexblack wrote:Hi,
This is a common problem with limited resources. I was very annoyed at the STM, as before designing the device I has to carefully choose which devices to use which functions to avoid conflict. No flexibility!

Do you have experiences with any alternatives? I am currently evaluating a project where I'd literally need all the peripherals of the STM32F407 and I don't have to tell you how this is not going to work out...


~ Tectu
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 F4: SDIO & SPI1 on the same DMA stream

Post by Giovanni »

SPC5 devices have 16 DMA channels and a DMA-MUX that allows to associate any DMA channel to any peripheral. I would like to see that kind flexibility on the STM32 too. It would really not that hard to do.

Giovanni
alexblack
Posts: 277
Joined: Mon Sep 24, 2012 3:52 pm
Been thanked: 33 times

Re: STM32 F4: SDIO & SPI1 on the same DMA stream

Post by alexblack »

Hi,
Tectu wrote:Do you have experiences with any alternatives?
I am currently evaluating a project where I'd literally need all the peripherals of the STM32F407 and I don't have to tell you how this is not going to work out...
~ Tectu

I tried Atmel AT91SAM9XE512. It has individual DMA channel for every peripheral (in theory, I have not studied it well enough).
About using all peripherals on STM32 I think it is possible only with low peripherals speed and some restrictions, because not only DMA and bandwith resources for all peripherals is not enough, also it does not have enough pins, even in BGA176.
Post Reply