Nano GPIO-Interrupt Integration

Hi All,

I’m pretty new to the Jetson Nano. I have a couple of the 4GB dev kits, Model P3450, P/N 945-13450-0000-100. They’re running:
L4T v32.7.1
Jetpack v 4.6.3.
openCV v 4.1.1
Python 3

I’m capturing video from one camera and showing the image in a window. I’ve used USB cameras, webcams, and RPi cams, and have the same problem with each.

I’m using an encoder to just send numbers to the terminal, by polling GPIO states in the main loop. When I setup the GPIOs that are connected to the encoder A & B outputs, without any cameras capturing/displaying pictures, the encoder output to the terminal operates as expected. When rotated clockwise, the numbers increase and when rotated counterclockwise, they decrease. Their output is perfect, even when the 600ppr quadrature encoder is rotated very quickly. So far, so good.

When the main loop includes camera capture and display, the encoder operation has a great deal of difficulty. While rotating clockwise at any speed, the numbers sometimes increase and sometimes decrease by one step at a time. Same is true for counterclockwise. I believe the processor is too busy servicing the video to have adequate time to service the encoder. I’m thinking it misses most encoder changes and then when it sees one, it compares it to one that happened many pulses ago.

I’ve scoured the web for documentation or examples on how to properly use encoders with the Nano while processing video to no avail. I see a reference in the documentation to a GPIO interrupt capability but haven’t found any information as to how to implement it.

I’m not sure how to proceed but wonder if using a GPIO interrupt would better service the encoder changes. At least I could stack them in a queue for processing as the processor gets free time.

Can anyone point me in the right direction?



Welcome to the NVIDIA Developer forums. Your topic belongs in the Jetson category, I have moved it over for you.


Thank you.

1 Like

Nano does not have an interrupt pin so you would have to configure one of the gpio pins yourself. But you shouldn’t have to do that:

Does your program run on multiple threads?

It’s still early in the development cycle, so all is running in a single ‘main’ loop, not multi-threaded.

I can break up the code so, the encoder operation isn’t forced to run while video is playing. The encoder is for a jog wheel, so its pins can be polled only when the video is paused. That should clear up the cycle scarcity issue. But I suspect interrupts will be required before the project is done. As I mentioned before, I’m new to the Jetson Nano. Processors I’ve used previously, have had registers where interrupts are initialized and serviced. I’m not seeing anything like that on the Nano. I’m not fluent with python either, so there’s a learning curve there as well.

I don’t know how to setup a GPIO pin for generating an interrupt. I’ve seen how the utility works, but don’t see how it can setup an interrupt. I’d like to learn how to use interrupts, even if it’s not necessary for the encoder. Can you point me in a direction to learn about implementing interrupts? (Hopefully using python.)



Using python I would go for the standard Nvidia gpio library, check out this sample: jetson-gpio/ at master · NVIDIA/jetson-gpio · GitHub