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?
Thanks,
robin