AnsweredAssumed Answered

Configured GPIO interrupt but ISR is not hitting

Question asked by Phani Teja on Apr 18, 2018
Latest reply on May 14, 2018 by Shivani Patel

Hello,

I am using IMX6.ULL board, I have followed the thread 381277 to configure a GPIO pin and to trigger isr when interrupt happened

 

DTS changes:

 &iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog_1>;
pinctrl_hog_1: hoggrp-1 {
fsl,pins = <
MX6UL_PAD_UART1_RTS_B__GPIO1_IO19 0x17059  /* ADDED THIS LINE */

 

driver:

#define IMX_GPIO_NR(bank, nr) (((bank) - 1) * 32 + (nr))

#define GPIO_PIN IMX_GPIO_NR(1, 19)
#define INPUT_PIN_DESC "gpio_pin_test"
#define GPIO_DEVICE_DESC "my_device"

 

gpio_request(gpio_pin, INPUT_PIN_DESC);
gpio_direction_output(gpio_pin, 0);
gpio_export(gpio_pin, false);

gpio_to_irq(gpio_pin);

request_irq(irq_input_pin, (irq_handler_t ) r_irq_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, INPUT_PIN_DESC, GPIO_DEVICE_DESC);


static irqreturn_t r_irq_handler(int irq, void *dev_id) {

unsigned long flags;

local_irq_save(flags);

/* TODO: Need to blink a LED here */
printk(KERN_NOTICE "Interrupt [%d] for device %s was triggered !.\n", irq, (char *)dev_id);

local_irq_restore(flags);

return IRQ_HANDLED;
}

 

After loading driver I am able to see the registered interrupt(cat /sys/proc/interrupts) and I am able to change the value of the gpio(echo 1 > /sys/class/gpio/gpio19/value)

 

Here are my issues:

1. My ISR is not hitting when I set or clear the GPIO values

2. GPIO19 folder is not showing the direction interface.

 

Could you anybody suggest what I am missing.

 

Thanks,

Phani Movva

Outcomes