- Needs a
10uS
pulse - Reading at
30Hz
Tricks
- Useful stm32 timer formulas
- Remember to start the timer
- Using bypass clock at 8MHz coming from ST-Link board
- Using
TIM4
, andCH3
andCH4
(for testing) for trigger APBx
clocks are at 96MHzPrescaler
at50-1
Period
at64000-1
- This gives a timer frequency of
30Hz
- Pulse is set to
19200
giving a 10ms pulse onPD14
- Using
TIM4
,CH1
,PD12
for input capture, set to rising and falling edges - Using interrupts to calculate the period of the echo pulse and the related distance
- Output (distance) is printed to USB configured as a virtual serial device