Thanks! This series is really helpful. I followed this PWM tut with my STM32WLE5x board using PB3, TIM2_CH2. One thing I notice is that Delay hangs the program. A workaround is using cortex_m::delay::Delay.
Thank you for the feedback, Wang! You probably noticed that I used embassy_time::Delay to implement a blocking delay, which also required me to import embedded_hal::blocking::delay::DelayMs. My guess is that what's happening could have to do with the embedded_hal implementation for DelayMs on the particular device you are using. Either way, what you are doing is a totally valid alternative to generate a blocking delay, however, instead using the Cortex-M core crate.
Omar Hiari Finally I figured out why the embassy_time::Delay does not work. It is implemented using embassy_time::Instant, which uses TIM2(time-driver-any feature). My selected PWM pin(TIM2_CH2) also uses the TIM2 timer, so the instant value resets at each PWM cycle, resulting in an unusable Instant.
Never mind, cortex_m::delay::Delay works great.