AnsweredAssumed Answered

HAL Timer PWM DMA Completion

Question asked by John Craven on Apr 27, 2017

I have an app running on F303 where i build an waveform buffer of PWM widths (CCR1) and then periodically send the waveform using HAL_TIM_PWM_Start_DMA. Project is CUBE generated. It all works find, resending the waveform in the main loop. 

 

I have done DMA receives with UARTs and understand how the half complete and complete interrupts work.

 

But i cant figure out how to setup up an HAL interrupt callback that notifies me when the whole waveform has been sent. If anybody can help me out it would be much appreciated. 

 

Bulk of code looks like this;

uint16_t buffer[192];
uint32_t buflen;

 

int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_TIM16_Init();

  /* USER CODE BEGIN 2 */

  SetupBufferFromID(0b110011); //generate a DMA waveform buffer

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

          HAL_TIM_PWM_Start_DMA(&htim16, TIM_CHANNEL_1, (uint32_t*)buffer, buflen); //send the transponder waveform
          HAL_Delay(10);

  }
  /* USER CODE END 3 */

}

 

full main.c attached.

Attachments

Outcomes