Jump to content

GPIO IRQ assignment failure


Recommended Posts

Before I file a bug for this, I want to make sure I'm not doing something wrong.

I am trying to enable PPS on GPIO pin PD14 of an Orange Pi PC2.   I've enabled the pps-gpio and uart overlays in my /boot/armbianEnv.txt file and rebooted.  


root@ntp0:~# cat /boot/armbianEnv.txt 
overlays=pps-gpio uart1 


On reboot I see the following problem in dmesg:


[    5.542593] pps-gpio pps@0: failed to map GPIO to IRQ: -22
[    5.542626] pps-gpio: probe of pps@0 failed with error -22


If I 'rmmod/modprobe' the pps-gpio/pps-ldisc modules I see pps0 created:


[   54.983158] pps pps0: new PPS source serial1
[   54.983284] pps pps0: source "/dev/ttyS1" added


Yet I am not getting PPS data on pps0 even with the gps locked as measured by cgps/gpsmon.

root@ntp0:~# ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqklqqqqqqqqqqqqqqqqqqSeen 12/Used  9k
x Time:        2022-04-17T18:35:49.000Z (0) xxGNSS   PRN  Elev   Azim   SNR Usex
x Latitude:         xx.xxxxxxxx N           xxGP  1    1  26.0   49.0  15.0  Y x
x Longitude:        yy.yyyyyyyy W           xxGP  6    6  23.0  169.0  18.0  Y x
x Alt (HAE, MSL):   6353.675,   6407.480 ft xxGP 13   13  28.0  235.0  18.0  Y x
x Speed:             0.11 mph               xxGP 14   14  54.0   72.0  21.0  Y x
x Track (true, var):   332.6,  11.0     deg xxGP 15   15  18.0  270.0  23.0  Y x
x Climb:             0.00 ft/min            xxGP 17   17  84.0   23.0  22.0  Y x
x Status:         3D FIX (9 secs)           xxGP 19   19  70.0  231.0  21.0  Y x
x Long Err  (XDOP, EPX):  0.61, +/- 30.1 ft xxGP 24   24  21.0  314.0  28.0  Y x
x Lat Err   (YDOP, EPY):  0.64, +/- 31.6 ft xxGP 30   30  26.0  151.0  16.0  Y x
x Alt Err   (VDOP, EPV):  0.81, +/- 61.1 ft xxGP  7    7   2.0  146.0   0.0  N x
x 2D Err    (HDOP, CEP):  0.87, +/- 54.2 ft xxGP 21   21   3.0   32.0   0.0  N x
x 3D Err    (PDOP, SEP):  1.19, +/- 74.2 ft xxSB134   47   0.0    0.0   0.0  N x
x Time Err  (TDOP):       0.88              xx                                 x
x Geo Err   (GDOP):       1.87              xx                                 x
x ECEF X, VX:              n/a    n/a       xx                                 x
x ECEF Y, VY:              n/a    n/a       xx                                 x
x ECEF Z, VZ:              n/a    n/a       xx                                 x
x Speed Err (EPS):       +/- 43.0 mph       xx                                 x
x Track Err (EPD):        n/a               xx                                 x
x Time offset:            0.551504007 s     xx                                 x
x Grid Square:            AABBCCDD          xx                                 x

(location/grid square redacted)


Looking at what the kernel thinks it has for gpio pins enabled I see this:


root@ntp0:~# cat /sys/kernel/debug/gpio 
gpiochip1: GPIOs 0-223, parent: platform/1c20800.pinctrl, 1c20800.pinctrl:
 gpio-20  (                    |orangepi:red:status ) out lo 
 gpio-102 (                    |gmac-3v3            ) out hi 
 gpio-166 (                    |cd                  ) in  lo IRQ ACTIVE LOW
 gpio-204 (                    |usb0_id_det         ) in  hi IRQ 

gpiochip0: GPIOs 352-383, parent: platform/1f02c00.pinctrl, 1f02c00.pinctrl:
 gpio-354 (                    |usb0-vbus           ) out lo 
 gpio-355 (                    |sw4                 ) in  hi IRQ ACTIVE LOW
 gpio-362 (                    |orangepi:green:pwr  ) out hi 


Is this indeed a case of the pin not being assigned an interrupt or is the pps-gpio IRQ mapping message unrelated to the problem?




Link to comment
Share on other sites

Armbian Linux community supported weekly builds download

On 4/17/2022 at 1:03 PM, Werner said:

Providing logs with 

armbianmonitor -u

 helps with troubleshooting and significantly raises chances that issue gets addressed.

Thanks for the reply

While I wasn't necessarily asking for assistance I won't say no to help :)


It seems as if I am only able to post one message a day here so please understand the delayed replies.    I walked the log file and noticed that it has three different reboots captured; two are with the overlay included and the last is without it.   I wondered whether or not there may have been a conflict with r-gpio-keys so I removed pps-gpio; no change.

I also downloaded kernel source but I haven't quite figured out where I should start debugging the code.   From what I can tell the message in dmesg is coming from line 177 of drivers/pps/client/pps-gpio.c.  That seems to be the result of a return from gpiod_to_irq which seems to be defined in the include file linux/gpio/consumer.h.   It seems the only thing this function does is warn and return -EINVAL which I see EINVAL is defined as 22 in uapi/asm-generic/errno-base.h.     We drop into pps-gpio.c from a call to pps_gpio_probe.    I'm guessing that this is called when kernel loads the pps-gpio module from a modprobe.    Other than looking at the overlays in arch/arm64/boot/dts/allwinner/* I haven't made much headway in figuring out the problem.  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...