AnsweredAssumed Answered

Suggestion for TIM_DMABurst_WriteStart()

Question asked by lecordier.guy.001 on Aug 4, 2016
Latest reply on Aug 31, 2016 by ForumSTM32.ForumSTM3


  Dear,

I want to generate the 4 signals for a H bridge to create a sinusoidal signal by pwm
So I used Timer 1 and its 4 channels powered by a DMA in burst mode

 The PWM data are organized in an array of 360 structures
 {
 {CCR1, CCR2, CCR3, CCR4},
 …
 {CCR1, CCR2, CCR3, CCR4},
 }
 
 I wanted to start by HAL_TIM_DMABurst_WriteStart() but I found this function not enough flexible as the same variable (BurstLength) is used to program:
 the number of data to transfer in the DMA_SxNDTR register
  /* Enable the DMA Stream */
  HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U);    
 and the DMA burst length in the TIM1_DCR timer   
  /* configure the DMA Burst Mode */
  htim->Instance->DCR = BurstBaseAddress | BurstLength; 

  I think it should be different; in my case
  /* Enable the DMA Stream */
  HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, 360*4;     
  /* configure the DMA Burst Mode */
  htim->Instance->DCR = BurstBaseAddress | TIM_DMABURSTLENGTH_4TRANSFERS; 

 In final
  HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc,
                                              uint32_t* BurstBuffer, uint32_t  BurstLength)
 should be
 
  HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc,
                                              uint32_t* Buffer, uint32_t  BufferLength,
                                              uint32_t  BurstLength)

 My platform is STM32F429 Cube_FW_F4_V1.12.0

Regards

Outcomes