cancel
Showing results for 
Search instead for 
Did you mean: 

about gpdma transmission size

dh_leslie
Associate II

I am porting code from G473 to U575 because I need more flash and ram.

Then I meet some issues on gpdma transmission size.

For G473, I use dma to transfer data to timer ARR likes:

uint16_t buf[65536] = { ..... };

HAL_TIM_Base_Start_DMA(&htim1, (uint32_t *)buf, 65536);

For U575, the code doesn't work because the size have to be 65536 * sizeof(uint16_t), not the number of buf.

Is there any way to figure it out?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The code presented cannot work, either at 65536 or at 65536 * sizeof(uint16_t).

 

The CNDT register field is 16 bits and accept a maximum value of 65535.

The HAL_TIM_Base_Start_DMA also accept a max value of 65535.

/**
  * @brief  Starts the TIM Base generation in DMA mode.
  * @PAram  htim TIM Base handle
  * @PAram  pData The source Buffer address.
  * @PAram  Length The length of data to be transferred from memory to peripheral.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, const uint32_t *pData, uint16_t Length)
{

 

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

4 REPLIES 4
TDK
Guru

The code presented cannot work, either at 65536 or at 65536 * sizeof(uint16_t).

 

The CNDT register field is 16 bits and accept a maximum value of 65535.

The HAL_TIM_Base_Start_DMA also accept a max value of 65535.

/**
  * @brief  Starts the TIM Base generation in DMA mode.
  * @PAram  htim TIM Base handle
  * @PAram  pData The source Buffer address.
  * @PAram  Length The length of data to be transferred from memory to peripheral.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, const uint32_t *pData, uint16_t Length)
{

 

 

If you feel a post has answered your question, please click "Accept as Solution".

Yes, you are right.

Currently, I only use 16384 in G473. But I want to port code to U575 and use more buf in DMA.

And I found the definition is different between G4 and U5 in DMA size.

In G473, the code below is ok.

uint16_t buf[4] = { ..... };

HAL_TIM_Base_Start_DMA(&htim1, (uint32_t *)buf, 4);

I tried this in U575, buf[2] and buf[3] will not be transfered,unless I set the size = 4 * sizeof(uint16_t).