Hello all.
I want to use a GPIO as an input counter on an iMX28 board. I'm using kernel 2.6.35 from the Freescale BSP.
For testing I connected a digital output of my board to a digital input. The good news first. When reading the value of the GPIO everything seems okay. It changes whenever I switch my digital output.
The bad news: I'm observing three problems.
1. Despite configuring for rising or falling edges I'm seeing the interrupt counter increasing everytime I do switch the digital output. I expected that there isn't any rising edge when switching from 1 to 0. Or did I misunderstood the meaning of rising edge?
2. I'm not able to configure the trigger to detect "both" edges. Why?
root@iMX28:/# echo both > /sys/class/gpio/gpio116/edge
[ 642.890000] setting trigger mode 3 for irq 244 failed (mxs_gpio_set_irq_type+0x0/0x58)
3. For one event the interrupt counter increases by a higher value depending on the utilization of the system (up to 9). I would expect it to increase by one for one event. I even looked at the signal with an oscillator but couldn't observe any strange things with the ramps.
Log:
# detect rising edges
root@iMX28:/# echo rising > /sys/class/gpio/gpio116/edge
# print gpio configuration for gpio 116
root@iMX28:/# cat /sys/kernel/debug/gpio | grep 116
gpio-116 (Digital Input 1 ) in hi irq-244 edge-falling
# show interrupt counter
root@iMX28:/# cat /proc/interrupts |grep gpio
244: 1 - gpiolib
# switch to 1
root@iMX28:/# echo 1 > /sys/class/gpio/gpio74/value
# show interrupt counter again
root@iMX28:/# cat /proc/interrupts |grep gpio
244: 5 - gpiolib
# switch to 0
root@iMX28:/# echo 0 > /sys/class/gpio/gpio74/value
# show interrupt counter
root@iMX28:/# cat /proc/interrupts |grep gpio
244: 14 - gpiolib
I also tried with an external signal generator but the problem persists. Now the question:
Hardware problem? Kernel problem? pebcak?
Any help is appreciated.
Regards
Oliver