Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 1 month ago.
timer measurement error? STM32L152
I am using the timer.read_us() to measure the time for a give routine. I tried to verify the result with a oscilloscope, but get a pretty larger different. On two different oscilloscopes I measure 5.5 ms for a routine. With reading the time I get about 4.5 ms. I am sure there is some register somewhere to correct this, but I using generic mbed code. Any ideas would be appreciated.
1 Answer
10 years, 1 month ago.
The STM boards are running out of the internal oscillator. If you need a more precise timing source, you have to add a external crystal. See http://mbed.org/users/dreschpe/code/ST_401_84MHZ/ for picture. The newer mbed lib will detect this and use it : http://mbed.org/teams/ST/wiki/Automatic-clock-configuration