STM32F0, can I2C and SPI be used concurrently? DMA?

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

Moderator: RoccoMarco

Post Reply
colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

STM32F0, can I2C and SPI be used concurrently? DMA?

Post by colin »

I noticed in the STM32F0 I2C and SPI driver that they both require DMA and it looks like the I2C and SPI peripherals have conflicting DMA channel assignments based on my reading of the _lld header file. Is this true?

If so, what does that mean? Can a program use the I2C and SPI peripheral that use the same DMA channel? Will the HAL drivers wait until the DMA channel is available, or will it crash or otherwise fail?

Is there any reason not to implement an interrupt-driven option for the I2C driver? Since I2C is generally run at much slower bit rates than SPI it would make more sense to do it there.

How about the STM32F4 -- does it have this kind of conflict between DMA channels? It sounds like it has a much more advanced DMA system.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F0, can I2C and SPI be used concurrently? DMA?

Post by Giovanni »

Hi,

You can use both drivers, just not at the same time. You need to call xxxStart(), use xxx, xxxStop(), yyyStart(), use yyy, yyyStop() and so on.

The start and stop functions call internally the DMA manages that allocates/releases the associated DMA channels dynamically.

Giovanni
Post Reply