EXTI event timestamping newbie

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
cenzo
Posts: 3
Joined: Fri Mar 01, 2013 7:06 pm

EXTI event timestamping newbie

Post 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
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: EXTI event timestamping newbie

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: EXTI event timestamping newbie

Post 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
Post Reply