Page 1 of 1

PIO Input Change interrupt

Posted: Thu May 18, 2017 9:32 pm

Using CPU SAM9G20 I am trying to get an interrupt on PIO Input Change.
I am using PA26 pin and PIOA controller. Currently having some issues to init the controller.

My code is:

volatile unsigned int reg ;
volatile unsigned int reg1 ;

pioa_clk = clk_get(NULL, "pioA_clk");

at91_set_gpio_input(AT91_PIN_PA26, 1);
at91_sys_write(AT91_PIOA + PIO_IER, 1<<26);

reg = at91_sys_read(AT91_PIOA + PIO_IMR);
printk(KERN_ERR "at91_sys_read: %x\n", reg);

reg1 = at91_sys_read(AT91_PIOA + PIO_IMR);
printk(KERN_ERR "one more time at91_sys_read: %x\n", reg1);

Here is the output:
at91_sys_read: 4000000
one more time at91_sys_read: 0

It shows that the mask has gone after the second read of PIO_IMR register. What could happen ?

Thank you,

Re: PIO Input Change interrupt

Posted: Thu Jun 01, 2017 12:17 am
by blue_z
What does your "code" represent?
It could be old 2.6.xx kernel code, but why is there clock initialization?

Try dumping the entire register block for PIOA before and after.