Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWM on TIM16 and TIM17 - STM32G0B1 #3396

Open
gworkman opened this issue Oct 6, 2024 · 1 comment
Open

PWM on TIM16 and TIM17 - STM32G0B1 #3396

gworkman opened this issue Oct 6, 2024 · 1 comment

Comments

@gworkman
Copy link

gworkman commented Oct 6, 2024

Hello! This is my first time using Embassy, it's been great so far!

One thing I'm having trouble with is setting up PWM for TIM16 and TIM17. These are not quite the same as default timers, as they only have one channel each, rather than the standard four channels. I set them up the same way that I successfully initialized TIM3 & TIM4 for PWM, but it doesn't output anything for TIM16 and TIM17.

My code looks as follows:

    let mut motor1 = SimplePwm::new(
        p.TIM16,
        Some(PwmPin::new_ch1(p.PD0, OutputType::PushPull)),
        None,
        None,
        None,
        PWM_FREQUENCY,
        CountingMode::EdgeAlignedUp,
    );

    motor1.set_polarity(Channel::Ch1, OutputPolarity::ActiveHigh);
    motor1.enable(Channel::Ch1);
    motor1.set_duty(Channel::Ch1, motor1.get_max_duty());

Any help appreciated :)

@gworkman
Copy link
Author

gworkman commented Oct 6, 2024

Edit: the exact microcontroller is STM32G0B1CBT6, if that is useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant