STM32F1 DMA stream already allocated
Posted: Thu Sep 13, 2018 12:42 pm
Hi,
I encountered a DMA issue with my STM32F103 after porting my project to ChibiOS 18.2.x. When calling spiStart() on SPID2, I get a kernel panic in the spi_lld_start() function (DMA stream already allocated). The problem seems to be that I also use I2CD2, which allocates the same DMA channels before (if I call spiStart() before i2cStart() I get a similar panic from i2c_lld_start() ).
What confuses me, is that with ChibiOS 17.6.x I could use I2C2 and SPI2 at the same time without issues. I further noticed that the SPIConfig is not fully utilized as the cr2 field is never read. Hence, it makes no difference whether or not I set the SPI_CR1_RXDMAEN and SPI_CR1_TXDMAEN flags.
All in all, my questions are: Should it be possible to "share" the same DMA among multiple peripherals and there is a bug in 18.2.x, or was there a bug in 17.6.x (and all earlier versions) that such configurations were allowed? If its not possible, how can I disable DMA for I2C (I'd rather keep the SPI DMA even if i could disable it via the cr2 field)?
Best regards,
Thomas
I encountered a DMA issue with my STM32F103 after porting my project to ChibiOS 18.2.x. When calling spiStart() on SPID2, I get a kernel panic in the spi_lld_start() function (DMA stream already allocated). The problem seems to be that I also use I2CD2, which allocates the same DMA channels before (if I call spiStart() before i2cStart() I get a similar panic from i2c_lld_start() ).
What confuses me, is that with ChibiOS 17.6.x I could use I2C2 and SPI2 at the same time without issues. I further noticed that the SPIConfig is not fully utilized as the cr2 field is never read. Hence, it makes no difference whether or not I set the SPI_CR1_RXDMAEN and SPI_CR1_TXDMAEN flags.
All in all, my questions are: Should it be possible to "share" the same DMA among multiple peripherals and there is a bug in 18.2.x, or was there a bug in 17.6.x (and all earlier versions) that such configurations were allowed? If its not possible, how can I disable DMA for I2C (I'd rather keep the SPI DMA even if i could disable it via the cr2 field)?
Best regards,
Thomas