AnsweredAssumed Answered

stm32 DMA request per channel + multple peripherals

Question asked by sbm on Nov 23, 2015
Latest reply on Nov 23, 2015 by Clive One

I would like to use the DMA with diferent peripherals of a stm32.Here are the resuming points.
target MCU: STM32L0
purpose : Dma + uart1+uart2+uart3 +spi+i2c

For instance i succeded configuring the uart2 with the dma with the following configuration:

     hdma_tx.Instance                 = DMA1_Channel4;
      hdma_tx.Init.Request             = DMA_REQUEST_4;
      __HAL_LINKDMA(UartObject_tS, hdmatx, hdma_tx);
      hdma_rx.Instance              = DMA1_Channel5;
      hdma_rx.Init.Request             = DMA_REQUEST_4;
      __HAL_LINKDMA(UartObject_tS, hdmarx, hdma_rx);

 if i change the configuration to uart1 it would give something like this:

     hdma_tx.Instance                 = DMA1_Channel2;
     hdma_tx.Init.Request             = DMA_REQUEST_3;
      __HAL_LINKDMA(UartObject_tS, hdmatx, hdma_tx);
      hdma_rx.Instance              = DMA1_Channel3;
      hdma_rx.Init.Request             = DMA_REQUEST_3;
      __HAL_LINKDMA(UartObject_tS, hdmarx, hdma_rx);

I tested each one separately and the corresponfding IRQ handler is triggered.

Now if i would like to use the UART1, UART2 and LPUART1 (aka UART3). I would apply the same reasoning.

//UART3 aka LPUART1 
   hdma_tx.Instance                 = DMA1_Channel7;
      hdma_tx.Init.Request             = DMA_REQUEST_5;
      __HAL_LINKDMA(UartObject_tS, hdmatx, hdma_tx);
      hdma_rx.Instance              = DMA1_Channel6;
      hdma_rx.Init.Request             = DMA_REQUEST_5;
      __HAL_LINKDMA(UartObject_tS, hdmarx, hdma_rx);

At this point i think all is ok as each DMA channel has individual peripheral request signals.

But what happens if i need to use the spi2 in the same way knowing that all dma channel request are used?
According the datasheet ( "only one request shall be enabled at a time" (p240)) and the dma request mapping (p241) , how can I achieve this ? is it possible ? Shall another strategy be followed? Can other peripheral request signals be mapped in the same dma channel ??
If yes, how are they handdled ?

Thanks in advance.