Skip to main content
HJang.3
Associate II
September 14, 2022
Question

How to change pwm polarity or PWM mode after each DMA cycle.

  • September 14, 2022
  • 4 replies
  • 1297 views

I am using STM32F103C8T6, timer 1 ch 1 to generate complementary PWM

with variable duty cycle Using DMA buffer

 HAL_TIM_Base_Start(&htim1);
 HAL_TIM_PWM_Start_DMA(&htim1, TIM_CHANNEL_1, (uint32_t *) base, 30);
 HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1);

Now i want to invert PWM polarity or PWM mode after each DMA transfer.

without changing Phase of PWM.

Thanks.

4 replies

waclawek.jan
Super User
September 14, 2022

This probably can't be done without transients.Simply change polarity in the DMA transfer complete interrupt, or maybe delay it by some fixed time.

JW

HJang.3
HJang.3Author
Associate II
September 14, 2022

can you please tell how to change polarity during transfer complete interrupt.

thannara123
Associate III
August 21, 2024

Hai did you find the solution ?

Andrew Neil
Super User
August 21, 2024
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.