Is there a way to test the functionality of GPIO interrupts without having to physically drive the line as input and controlling the
pin state externally?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
The interrupt path for GPIO on TDA4/J721e/J7200:
GPIO --> INTR(GPIO Interrupt Router) --> GIC500
Also note that in the Linux driver there is support for banked interrupts only & no support for unbanked interrupts.
We can validate the entire GPIO interrupt path mentioned above without even having to externally control
the GPIO pin. Here is a simple code snippet to configure a GPIO pin and register an interrupt handler.
Trick to generate/fake interrupt is to configure the GPIO as output & toggle the state of GPIO.
Apply the above patch to Linux directory of PSDKLA 8.0
cd $PSDKLA_PATH/board-support/linux* git am 0001-davinci_gpio-Test-interrupts.patch cd ../.. make linux Insert the SD card Edit Rules.make to point DESTDIR to rootfs of SD card: DESTDIR=/media/$USER/rootfs sudo make linux_install sync
This should register a test interrupt handler for wkup_gpio module GPIO_52.
Once we boot up we need to figure out the GPIO numbering in Linux for wkup_gpio_52
So the wkup_gpio module starts with 372 & hence wkup_gpio_52 will be 372+52 = 424
echo 424 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio424/direction
echo 1 > /sys/class/gpio/gpio424/value
One can see the print from wkup_gpio_52 test interrupt handler.
[ 83.608230] test_irq: irq 293, val=0
We can also check the interrupt count increase:
cat /proc/interrupts | grep key-gpio
293: 2 0 GPIO 52 Edge -davinci_gpio key-gpio