Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A13 => Topic started by: bianchina3 on November 06, 2012, 10:20:12 PM

Title: A13 External interrupts
Post by: bianchina3 on November 06, 2012, 10:20:12 PM
Does anyone have idea how the external interrupts can be used in this processor ?

Regards.
Title: Re: A13 External interrupts
Post by: vinifr on November 10, 2012, 02:28:26 AM
Generally uses up interruption in drivers. I guess you can not use them outside(drivers).
"Interrupt handlers (ISRs) execute in interrupt context."

So you must to write a device driver and insert a interrupt handler(isr).

A good book about this is Essential Linux Device Drivers or Linux Device Drivers.  ;)
Title: Re: A13 External interrupts
Post by: bianchina3 on November 10, 2012, 08:33:45 PM
My question is not how to write a linux device driver.

My questions are
1) what gpio pin can i use to connect my interrupt pulse ?
2) how to write fex file to use gpio pin as interrupt ?

Title: Re: A13 External interrupts
Post by: David Goadby on November 15, 2012, 05:25:36 AM
I'm interested in the solution to this too.

The A13 data sheet seems to indicate that external interrupts EINT0..EINT16 are mapped to I/O pins PG0..PG12, PE0, PE1 and PB2. Even knowing the I/O pins and updating the fex file will not enable the interrupts. What is missing is how we access the interrupt controller to enable them and where the vectors are located.

I think that viniciusfre is correct about writing a driver to handle the interrupts once external interrupts are enabled. Armed (no pun intended) with the information about the Interrupt Controller this is quite easy to do. right now I don't see a way forward.

The problem is the A13 manufacturer does not give us all of the information we need. There are references to the use of interrupts on the A13 on at least two other forums.

I a currently trawling the source code on git-hub to see if there are any clues there.
Title: Re: A13 External interrupts
Post by: David Goadby on November 15, 2012, 06:17:38 AM
Here is some very low level information about interrupts: 

https://github.com/linux-sunxi/linux-sunxi/blob/sunxi-3.0/arch/arm/mach-sun4i/include/mach/platform.h
https://github.com/linux-sunxi/linux-sunxi/blob/sunxi-3.0/arch/arm/mach-sun4i/include/mach/irqs.h

Now, all we need to do is determine what bits do what and we can write our own interrupt handler..... ;-)

Update: I meant to say device driver. I have written fairly simple drivers for SUSE Linux but on a standard 808X box where we have the information. I'm still delving in the source code for clues.
Title: Re: A13 External interrupts
Post by: vinifr on November 15, 2012, 05:07:08 PM
if I'm wrong someone correct me.

Like i said, is not possible to use interrupts outside drivers. The reason is because the operating system does not allow access hardware resources outside drivers! :o Therefore it is necessary to write a driver.

In interrupt context you can to access hardware resources.
"Interrupt handlers (ISRs) execute in interrupt context."
"ISRs are critical pieces of code that directly converse with the hardware. They are given the privilege of instant
execution in the larger interest of system performance."


Example: http://dl.dropbox.com/u/22273442/interrupt.c (http://dl.dropbox.com/u/22273442/interrupt.c)
Title: Re: A13 External interrupts
Post by: meerd on December 05, 2012, 07:06:09 PM
Is there any progress about this subject? Was anyone able to find any information about external interrupt handling via GPIOs?
Title: Re: A13 External interrupts
Post by: lorenzo on December 23, 2012, 11:38:28 PM
Hi,

in this thread https://www.olimex.com/forum/index.php?topic=462.0 you can find useful information about how to set an external GPIO as interrupt source. Any of the EINT pin can work as external interrupt source.

Best regards.
Lorenzo
Title: Re: A13 External interrupts
Post by: bianchina3 on December 27, 2012, 07:16:10 PM
thank you lorenzo.
Title: Re: A13 External interrupts
Post by: vinifr on February 06, 2013, 11:40:53 PM
Hi, I was wrong, look here: http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=bks&srch=&fname=/SGI_Developer/REACTLINUX_PG/sgi_html/ch08.html (http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=bks&srch=&fname=/SGI_Developer/REACTLINUX_PG/sgi_html/ch08.html)  ;)

As lorenzo said, yo can to use any EINT, here have a list with all the pins available: http://linux-sunxi.org/A13/PIO (http://linux-sunxi.org/A13/PIO)