cancel
Showing results for 
Search instead for 
Did you mean: 

timer 3 channel 2 pwm influence channel 4

dorong
Associate II

Using stm32h743 device. when configuring timer 3 as pwm on channel 1 with phase on channel 2, we see that channel 4 will be influenced by channel 2
even though channel 4 was not defined.
if i configured channel 3 and 4 for pwm and phase i will have the same problem.
- if start only pwm on channel 3 and 4 (phase) and stop it will function well.
- if start only pwm on channel 1 and 1 (phase),  then start channel 3 and 4
  then stop channel 1 and channel 2 while channel 3 and 4 that generate pwm and then stop
  on channel 1 and 2, channel 4 will also stop.

I have configured other timers for pwm non of them had this problem.
if I clear timer 3 register using the code below before configuring timer 3 i will steel have the problem

__HAL_RCC_TIM3_CLK_ENABLE();
TIM3->CR1 = 0;
TIM3->CR2 = 0;
TIM3->SMCR = 0;
TIM3->DIER = 0;
TIM3->CCMR1 = 0;
TIM3->CCMR2 = 0;
TIM3->CCER = 0;
TIM3->BDTR = 0;
TIM3->EGR = TIM_EGR_UG; // Force update to reset counters and preload registers

TIM3->CCER &= ~TIM_CCER_CC4E;

 

 

4 REPLIES 4
waclawek.jan
Super User

Read out and show content of TIM registers for the waveform you have posted, and describe what do we see on that waveform - which color corresponds to which channel - and tell us how is it different from expected waveform.

> TIM3->CCER &= ~TIM_CCER_CC4E;

Disabled channel's pin is in high impedance, so if there is some coupling between the channels (resistive or capacitive), you may see unexpected changes on that disabled channel, especially if you observe it using logic analyzer rather than using oscilloscope.

JW

timer4bytimer2_cubemx.jpg

timer4bytimer2.jpg

The logic picture shows that channel 2 is almost complimentary to channel 4
on the cubeMx you can see that channel 4 is not defined and the output pin of channel 4 is 
also not defined.
I have replaced the evaluation board of stm32h743 and the same problem happening

LCE
Principal II

Check again what Jan said, about disabled channels / IOs.

on the cubeMx you can see that channel 4 is not defined and the output pin of channel 4 is also not defined.

So, CubeMX, have you been through all the auto-generated source code and checked how this pin has been set up?

In case of doubt, check the GPIO registers, and even better: initialize this GPIO.

dorong
Associate II

I have checked it time and time again 
timer 3 channel 1 is defined PWM generation on pin pb4
timer 3 channel 2 is defined PWM generation on pin pc7

PWM on pc7 is the one that influence pc9 even if pc9 is not configured
please check it on evaluation 743i-eval2