4 weeks ago.
What timer is wait_us(); using on Stm32L053?
Our target is a STM32L053. We started Timer21 for capture mode, on Pin PA_3:CH2. External 5KHz is on the pin. The CCMR2 is read and values are not stable. (We use timer2 and timer22 for PWM out).
No Timer timer; are used in the code, only FastPWM lib. We do use wait_us(50); in two places. Can this bother timer21?
3 weeks, 5 days ago.
It is defined here in the source code: https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/device/hal_tick.h
So sadly, the timer (which includes wait_us) runs on timer21. You can use the mbed-dev lib and modify it yourself to run on another timer. Or if it is not too critical, just create your own loop with a certain delay. Either just figure out in a few attempts how long your dummy loop needs to be for a certain delay. Or before you start the timer in capture mode, run your loop for a certain amount of cycles, use a Timer to measure how long your loop takes, and using that information calculate in your program how long you need to set your loop for a delay of 50us.
To post an answer, please log in.