HTE for TEGRA234_MAIN_GPIO

Dear Nvidia Team

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.
&tegra_hte_lic 0x19

Thank you for your support.

Best regards

hello sevm89,

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.

Hi JerryChang

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:

How are the GPIO IRQs mapped to LIC IRQs? Form the following link we think it should be possible to use the GPIO:
https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/SD/Bootloader/GpioInterruptMapConfig.html?highlight=lic

Kind regards
sevm89

hello sevm89,

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)

                i2c@3160000 {
                        compatible = "nvidia,tegra194-i2c";
                        reg = <0x00 0x3160000 0x00 0x100>;
                        status = "okay";
                        interrupts = <0x00 0x19 0x04>;

Hi JerryChang

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.

hello sevm89,

you may see-also Topic 192147.
but… let me double check which Jetpack release version you’re working with?

We are working with JetPack 6.1.

hello sevm89,

please refer to developer guide, GPIO Interrupt Mapping Configuration.

Hi JerryChang

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?

hello sevm89,

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.

Hi JerryChang

Which interrupt maps to the gpio main controller? We know the interrupts for the i2c-controllers, but we need to map a main gpio to the LIC IRQ.

hello sevm89,

you may $ cat /proc/interrupts for checking interrupts,
for instance,

227:          0          0          0          0  2200000.gpio  35 Edge      Force Recovery
228:          0          0          0          0  c2f0000.gpio  27 Edge      Power
229:          0          0          0          0  2200000.gpio  37 Edge      Suspend

however, I don’t have experience to map a MAIN GPIO to the LIC IRQ before.
may community share some test steps for reference.

Hi JerryChang

We found out how to use main gpios for timestamping. We get the following:

[ 1298.801328] HW timestamp(296: 7228): 1315305802880, edge: Unknown
[ 1298.851309] HW timestamp(296: 7229): 1315355795072, edge: Unknown
[ 1298.851325] HW timestamp(296: 7230): 1315355802656, edge: Unknown
[ 1298.870307] HW timestamp(296: 7231): 1315374795072, edge: Unknown
[ 1298.870323] HW timestamp(296: 7232): 1315374800896, edge: Unknown

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.

hello sevm89,

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);

Hi JerryChang

We are using the module hte-tegra194-test at the moment, therefore the flag is already IRQF_TRIGGER_RISING.

As additional information, at the moment, we define a gpio-key with the used gpio for timestamping. Otherwise we do not get the interrupts:

      key-fsync-input {
              label = "Fsync Input";
             gpios = <0xe3 0x8b 0x01>;
             linux,input-type = <0x01>;
             linux,code = <0x101>;
     };

Is there another way to achieve the registering of the interrupt? Could this lead to multiple time stamps?
Thank you.

Hi JerryChang

Do you have an update for us?
Thank you.

Is there an update?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.