Closed davidlattimore closed 2 years ago
I tested this on a G071 and was able to produce a 56MHz output while running the CPU at 875KHz.
let config = hal::rcc::Config::pll() .pll_cfg(hal::rcc::PllConfig { n: 21, r: 6, q: Some(3), ..hal::rcc::PllConfig::default() }) .ahb_psc(Prescaler::Div64); let mut rcc = dp.RCC.freeze(config); defmt::println!( "SYS: {} AHP: {} APB: {} PLLQ: {}", rcc.clocks.sys_clk.raw() / 1_000, rcc.clocks.ahb_clk.raw() / 1_000, rcc.clocks.apb_clk.raw() / 1_000, rcc.clocks.pll_clk.q.unwrap().raw() / 1_000 ); let gpioa = dp.GPIOA.split(&mut rcc); let pwm = dp.TIM1.pwm_q(56.MHz(), &mut rcc); let mut pwm_ch1 = pwm.bind_pin(gpioa.pa9.set_speed(Speed::VeryHigh)); let max = pwm_ch1.get_max_duty(); pwm_ch1.set_duty((max + 1) / 2); pwm_ch1.enable();
Thank you @davidlattimore 🚀
I tested this on a G071 and was able to produce a 56MHz output while running the CPU at 875KHz.