cancel
Showing results for 
Search instead for 
Did you mean: 

CORDIC with DMA is not woking when using LL drivers.

AR.10
Associate

Hi,

I am trying to use CORDIC in DMA mode in STM32G4 using LL drivers. However, the data from the input buffer is not being transferred to the CORDIC WDATA register. But the data from the CORDIC RDATA register (the initial value zero) is being transferred to the output buffer without waiting for input. I am following the same workflow as the CORDIC_Sin_DMA HAL example.

My code:

/* Configure CORDIC peripheral */

 LL_CORDIC_Config(CORDIC, LL_CORDIC_FUNCTION_SINE,  /* cosine function */

  LL_CORDIC_PRECISION_6CYCLES, /* max precision for q1.31 cosine */

  LL_CORDIC_SCALE_0,      /* no scale */

  LL_CORDIC_NBWRITE_1,     /* One input data: angle. Second input data (modulus) is 1 after cordic reset */

  LL_CORDIC_NBREAD_1,     /* Two output data: cosine, then sine */

  LL_CORDIC_INSIZE_32BITS,   /* q1.31 format for input data */

  LL_CORDIC_OUTSIZE_32BITS);  /* q1.31 format for output data */

 LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_2);

 LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_3);

 LL_DMA_ConfigAddresses(DMA1, LL_DMA_CHANNEL_2, (uint32_t)&CORDIC->RDATA,

 (uint32_t)outputAngles, LL_DMA_DIRECTION_PERIPH_TO_MEMORY);

 LL_DMA_ConfigAddresses(DMA1, LL_DMA_CHANNEL_3, (uint32_t)inputAngles,

 (uint32_t)&CORDIC->WDATA, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);

 LL_DMA_SetDataLength(DMA1, LL_DMA_CHANNEL_3, ARRAY_SIZE);

 LL_DMA_SetDataLength(DMA1, LL_DMA_CHANNEL_2, ARRAY_SIZE);

 /* Enable DMA transfer interruption: transfer error */

 LL_DMA_EnableIT_TE(DMA1, LL_DMA_CHANNEL_3);

 LL_DMA_EnableIT_TE(DMA1, LL_DMA_CHANNEL_2);

 /* Enable DMA transfer interruption: transfer complete */

  LL_DMA_EnableIT_TC(DMA1, LL_DMA_CHANNEL_3);

  LL_DMA_EnableIT_TC(DMA1, LL_DMA_CHANNEL_2);

  //Enable channels

  LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_3);

  LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_2);

  //Enable the CORDIC read and write requests.

  LL_CORDIC_EnableDMAReq_RD(CORDIC);

  LL_CORDIC_EnableDMAReq_WR(CORDIC);

0 REPLIES 0