jayhamlin123
Posts: 2
Joined: Fri Feb 15, 2013 11:48 pm

Fast (kernel level) GPIO Interrupts

Sat Feb 16, 2013 12:02 am

I got a kernel level ISR working for a data acquisition project. I found that user level ISRs (with wiringPi for example) have a latency of 25us and up. I needed a little better so I came up with this kernel level driver for interrupting on the rising edge of a gpio and writing data to a file, latency is reduced to 2.5us to 7us. There were lots of challenges, I put a description of the project here https://sites.google.com/site/hamlinhom ... rry-pi-isr
the source code is attached.
Enjoy,
Jay
Attachments
irqtest.zip
(16.89 KiB) Downloaded 1338 times

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

Re: Fast (kernel level) GPIO Interrupts

Sat Feb 16, 2013 9:48 am

Something somewhat similar http://www.raspberrypi.org/phpBB3/viewt ... 40#p255840

A kernel module spinning on a data strobe and then storing the sample. All gpios 0 to 31 are stored (all the user gpios are in this range). I timed a million samples in 1.8 seconds.

tvjon
Posts: 739
Joined: Mon Jan 07, 2013 9:11 am

Re: Fast (kernel level) GPIO Interrupts

Sat Feb 16, 2013 10:16 am

Thank you both for posting your source.

If there's no absolute requirement to use linux for the A2D project, then:

http://www.phlamethrower.co.uk/riscos/fiqprof.php

may be of interest?

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

Re: Fast (kernel level) GPIO Interrupts

Sat Feb 16, 2013 10:22 am

tvjon wrote:Thank you both for posting your source.

If there's no absolute requirement to use linux for the A2D project, then:

http://www.phlamethrower.co.uk/riscos/fiqprof.php

may be of interest?
Certainly interesting.

Any idea of the data rates that would achieve sampling the gpios?

tvjon
Posts: 739
Joined: Mon Jan 07, 2013 9:11 am

Re: Fast (kernel level) GPIO Interrupts

Sat Feb 16, 2013 10:38 am

I think so, yes.

I haven't tried his code yet Joan, being new to RiscOS, but rather impressed by its performance so far, & it's very responsive in use.

I just noticed both your posts & thought it might be handy for what you're both doing :)

Return to “Bare metal, Assembly language”