We’re trying to timestamp pulses on GPIO pins with the Generic Timestamping Engine (GTE). We’re using Legacy Interrupt Controller (LIC) to create interrupts on GPIO signal edges, allowing us to timestamp them with GTE.
This all works well as long as we have only one signal per GPIO controller, using interrupt 0. The issues begin when we try to map two signals to two different interrupts.
For example, we have a 1Hz signal on GPIO M3 and a 500Hz signal on GPIO Q1 (both in controller GPIO_CTL2). The 500Hz signal is not running all the time.
The default GPIO interrupt mapping configuration (t186ref/BCT/tegra194-mb1-bct-gpioint-p2888-0000-p2822-0000.cfg) is as follows:
gpio-intmap.port.M.pin.3 = 0; # GPIO M3 to INT0
gpio-intmap.port.Q.pin.1 = 0; # GPIO Q1 to INT0
With this configuration, we get the expected amount of GPIO interrupts on each pin (and we can verify this by checking /proc/interrupts at a regular interval). However, we can’t differentiate them in GTE; they’re both using LIC interrupt 304.
Below are different ways we’ve tried to configure this:
Configuration 1:
gpio-intmap.port.M.pin.3 = 1; # 1Hz
gpio-intmap.port.Q.pin.1 = 2; # 500Hz
If we map both pins to nonzero interrupts, we get no interrupts at all for either of them. It seems like interrupt 0 is different from all the rest.
Configuration 2:
gpio-intmap.port.M.pin.3 = 0; # 1Hz
gpio-intmap.port.Q.pin.1 = 1; # 500Hz
If we configure the 500Hz signal to interrupt 1, we get strange behavior. The 1Hz signal generates one interrupt a second, but so does the 500Hz signal (as seen in /proc/interrupts). It seems like only interrupt 0 is working properly. We’re basically missing 99.8% of the pulses we want to timestamp.
Configuration 3:
gpio-intmap.port.M.pin.3 = 1; # 1Hz
gpio-intmap.port.Q.pin.1 = 0; # 500Hz
On the other hand, if we make the 1Hz signal interrupt 1, we don’t get any interrupts at all when the 500Hz signal is off. Once we turn the 500Hz signal on, both signals get the correct amount of interrupts.
Questions:
- What is the dependence between different interrupt channels for a GPIO controller?
- How exactly can we configure the GPIO interrupt mapping so we can get different LIC interrupt numbers for two different pins in the same GPIO controller?