Christoph1985
Posts: 66
Joined: Sat Jul 28, 2012 11:58 am
Location: Germany

Event_detect / interrupt speed?

Wed Jul 02, 2014 9:35 am

Hello everybody,

I wondered how fast the Pi can recognize events that are triggered with the event detection of RPi.GPIO.
For example a speed measurement. One startsensor, one endsensor.
Will there be a significant delay?
A systematic delay?
How good is the repeatability?


Do you have any experiences with this?

Thank you very much.
elektronx.de

User avatar
joan
Posts: 15659
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Event_detect / interrupt speed?

Wed Jul 02, 2014 9:46 am

If you need accurate relative times you'll have to use pigpio, in particular for Python.

Christoph1985
Posts: 66
Joined: Sat Jul 28, 2012 11:58 am
Location: Germany

Re: Event_detect / interrupt speed?

Wed Jul 02, 2014 9:49 am

Thank you.

But why? ;-)
Do you have any explanation why pigpio is faster than RPi.GPIO?

Thanks
elektronx.de

User avatar
joan
Posts: 15659
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Event_detect / interrupt speed?

Wed Jul 02, 2014 9:58 am

Christoph1985 wrote:Thank you.

But why? ;-)
Do you have any explanation why pigpio is faster than RPi.GPIO?

Thanks
I didn't say faster. I said more accurate relative times. pigpio will also have more repeatable results.

pigpio timestamps the events at source to within a few microseconds. Other programs (Python and C etc.) timestamp when the program is woken up in response to the interrupt. The woken program has no idea when the event actually happened.

Christoph1985
Posts: 66
Joined: Sat Jul 28, 2012 11:58 am
Location: Germany

Re: Event_detect / interrupt speed?

Wed Jul 02, 2014 10:16 am

Ok thank you.
Now I got it.
I also found this topic that relates to mine: http://www.raspberrypi.org/forums/viewt ... 81&t=63203

One (hopefully) last question:
How do I convert the ticks into ms or s?

Thanks
elektronx.de

User avatar
joan
Posts: 15659
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Event_detect / interrupt speed?

Wed Jul 02, 2014 10:23 am

Christoph1985 wrote:Ok thank you.
Now I got it.
I also found this topic that relates to mine: http://www.raspberrypi.org/forums/viewt ... 81&t=63203

One (hopefully) last question:
How do I convert the ticks into ms or s?

Thanks
A tick is the number of microseconds since system boot. It's a 32 bit quantity so will wrap around after 71.6 minutes. From Python use pigpio.tickDiff() to find the relative time between two events.

Christoph1985
Posts: 66
Joined: Sat Jul 28, 2012 11:58 am
Location: Germany

Re: Event_detect / interrupt speed?

Wed Jul 02, 2014 11:19 am

That's it!
Thanks
elektronx.de

Return to “Python”