We need to get a timestamp from a GPIO on our current system design. As we do not have an AO GPIO available, we wonder if we also can use a GPIO from the main controller. We checked out the following topic:
This worked for a test when using the I2C controller as source. Now we have the following questions:
Is it possible to use an interrupt generated by the main gpio controller for timestamping?
If yes, how can we find out the number used for the tegra_hte_lic? 0x19 is the value of the i2c-controller. For example we would like to use GPIO3_PI.00 for timestamping.
it doesn’t works with MAIN GPIOs as mentioned by developer guide,
GTE provides hardware timestamping for state changes of specific signals, i.e. AON (Always On) domain GPIOs.
Thank you for your response.
There are also interrupts defined in the device tree for the main gpio-controller and to our understanding, for certain GPIOs interrupts are available (for example for the Force Recovery Button).
Why are these interrupts not usable with the Legacy Interrupt Controller to get a timestamp?
For the AGX Xavier and the GTE timestamp, this seemed to be working:
you may use LIC IRQ, in t234, the LIC IRQ line, it uses 0x19 interrupt which is i2c controller 1.
for example,
if you disassembler the Orin Nano dtb file into text file, $ dtc -I dtb -O dts -o temp.txt tegra234-p3768-0000+p3767-0003-nv.dtb
you’ll see the interrupt=0x19 for i2c@3160000 (i.e. gen1_i2c)
As written in the previous post, we know how to use the interrupt of the i2c controller. We tested it also successfully.
We now need to know how we can get the Interrupt number for a GPIO that is mapped to the LIC? Apparently in the file “bootloader/generic/BCT/tegra234-mb1-bct-gpioint-p3767-0000.dts” it is possible to map an GPIO to a specific interrupt. How do we get this number?
Thank you.
We posted the same link to the interrupt mapping in a previous post.
It is still not clear to us, how to get the tegra_hte_lic “number”. Let’s say for a test we want to get a timestamp when pressing the force recovery button. What is the interrupt number?
here’s test driver returns LIC IRQ hardware timestamps similar to the following: [ 15.752337] HW timestamp(25: 1): 41488438304, edge: Unknown
such 25 coming from 0x19, which maps to I2C controller i2c@3160000.
As edge, it is always unknown. Can this somehow be changed?
Also it seems that we get multiple timestamps per event. In our tests, we connected a PWM output to another GPIO and created the time stamps. For a PWM set to 50 Hz, we for example are getting 200 time stamps per second. If we take every forth timestamp into account, we get accurately the 20ms difference between them.
Any idea why it is like that? We configured the interrupt in the device tree to IRQ_TYPE_EDGE_RISING".
Thank you.
please give it a try by using IRQF_TRIGGER_RISING flag,
as you can see in the test driver,
for instance, $public_sources/kernel_src/kernel/3rdparty/canonical/linux-jammy/kernel-source/drivers/hte/hte-tegra194-test.c
hte.gpio_in_irq = ret;
ret = request_irq(ret, tegra_hte_test_gpio_isr,
IRQF_TRIGGER_RISING,
"tegra_hte_gpio_test_isr", &hte);