Page 1 of 1

EXTI event timestamping newbie

Posted: Wed Mar 06, 2013 11:53 am
by cenzo
Hi,

I am using the EXTI driver on a OLIMEX_STM32_H407 board to capture external events (i.e. data ready from a gyro).
What is the best/suggested way to grab an accurate time stamp for the event?

Since I do not need an RTC time stamp currently I am thinking to simply grab chTimeNow() within the EXTI routine;
is this a good way to have the most accurate time between two events (obtained subtracting the relevant time stamps of course)?

thanks in advance
Renzo

Re: EXTI event timestamping newbie

Posted: Wed Mar 06, 2013 12:32 pm
by Tectu
Without using an RTC, chTimeNow() is the best way that I know of. Maybe there is something else, but I don't know anything and chTimeNow() always worked great for me.


~ Tectu

Re: EXTI event timestamping newbie

Posted: Wed Mar 06, 2013 1:49 pm
by Giovanni
Hi,

You may want to use the ICU driver instead, it allows accurate measurements of periods and pulse widths. Alternatively you can read the RT counter using halGetCounterValue() from the EXT callback however you will have a noticeable measurement jitter caused by the ISR latency.

Giovanni