You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the timer in PWM input mode, channels 1 and 2 will be used as inputs.
However, channels 3 and 4 remain free, but they cannot be used as PWM output.
Previously, in version 0.21.0, this was not possible because the timer was moved to the ownership of the pwm_hz method.
let tim3 = Timer::new(dp.TIM3,&clocks);
tim3.pwm_hz(10.kHz());// tim3 move to pwm_hz// So, it's not possible to do this
tim3.pwm_input(1.kHz(), pwm_reader_ch1);
I thought that with the new version 0.22.0, where the timer is split into a PWM manager and channels, this would be possible.
But it still doesn't work.
let pwm_reader_ch1:Pin<'B',4> = gpiob.pb4.into_pull_down_input();let tim3 = Timer::new(dp.TIM3,&clocks);let(mut pwm_mngr,(_ch1, _ch2, ch3, ch4)) = tim3.pwm_hz(10.kHz());letmut ch3 = ch3.with(gpiob.pb0);
ch3.enable();
ch3.set_duty(50);// Error: cannot move out of dereference of `PwmHzManager<stm32f4xx_hal::pac::TIM3>`let monitor: timer::PwmInput<TIM3> = pwm_mngr.pwm_input(1.kHz(), pwm_reader_ch1);
The text was updated successfully, but these errors were encountered:
When using the timer in PWM input mode, channels 1 and 2 will be used as inputs.
However, channels 3 and 4 remain free, but they cannot be used as PWM output.
I even did not know something like this is possible. Input and output PWM on one timer.
Yes, in the STM32 microcontroller, it is possible to configure the same timer to work simultaneously as both an input (PWM input) and an output (PWM output), using different channels for each mode. This allows, for example, measuring an incoming PWM signal on one channel and generating an outgoing PWM signal on another channel of the same timer.
However, the functionality of PWM output will be somewhat limited. The timer has a shared clock generator, so the frequencies of PWM input and PWM output will depend on the same base clock signal.
You can configure different parameters for each channel, such as the duty cycle and other settings, but the main PWM frequency will be shared across all channels of a single timer.
Therefore, I think it’s not worth spending time adding such functionality, as it will be quite specific and limited. I just thought I was doing something wrong, but it turns out this is not implemented.
When using the timer in PWM input mode, channels 1 and 2 will be used as inputs.
However, channels 3 and 4 remain free, but they cannot be used as PWM output.
Previously, in version 0.21.0, this was not possible because the timer was moved to the ownership of the
pwm_hz
method.I thought that with the new version 0.22.0, where the timer is split into a PWM manager and channels, this would be possible.
But it still doesn't work.
The text was updated successfully, but these errors were encountered: