cancel
Showing results for 
Search instead for 
Did you mean: 

How to use DMAMUX generated events to trigger another DMA request

pj_stm
Associate III

Hi Guys.

I want to send data to UART using DMA. Every 3transfers I want to generate another DMA request to transfer data from the timer CNT register to memory. The documention of the DMAMUX is basically impossible to understand. They have lines and signals which basically are not connected to anything.

 

My naive interpretation of the RM:

NBREQ is keeping the number of requests to serve before generating the event.

pj_stm_1-1710958105878.png

The DMAMUX request generator generates the request which can be used by another DMAMUX channel and routed to the actual DMA

The code (minimal example):

  DMA1_Channel2 -> CNDTR = 10;
  DMA1_Channel2 -> CPAR = (uint32_t)&TIM15 -> CNT;
  DMA1_Channel2 -> CMAR = (uint32_t)data16;

  DMA1_Channel1 -> CNDTR = 6;
  DMA1_Channel1 -> CMAR = (uint32_t)data;
  DMA1_Channel1 -> CPAR = (uint32_t)&LPUART1 -> TDR;

  DMAMUX1_Channel0 -> CCR = DMA_REQUEST_LPUART1_TX | DMAMUX_CxCR_EGE | (2 << DMAMUX_CxCR_NBREQ_Pos);

  DMAMUX1_Channel1 -> CCR = DMA_REQUEST_GENERATOR0;

  DMAMUX1_RequestGenerator0 -> RGCR = DMAMUX_RGxCR_GPOL_Msk  | (0 << DMAMUX_RGxCR_GNBREQ_Pos);
  DMAMUX1_RequestGenerator0 -> RGCR |= DMAMUX_RGxCR_GE;

  DMA1_Channel1 -> CCR |= DMA_CCR_EN;
  DMA1_Channel2 -> CCR |= DMA_CCR_EN;
  LPUART1 -> CR3 |= USART_CR3_DMAT;

But unfortunately, it transfers the data to the LPUART, but does not generate the events which can be consumed by by the DMAMUX channel1.

 

Is it doable? What am I doing wrong?

 

1 REPLY 1
pj_stm
Associate III

I found the solution. From Table 58 sig_id field has to be sent to the correct value (in my case dmamux_evt0)