Can Nano UART be coded as an interupt?

Hi,

I am trying to interface Jetson Nano with STM32 through a Python code. I was able to successfully communicate and achieve the result that I needed but as the complexity of the code increases, I prefer to work work with interrupts instead of polling for UART data. I am trying to simulate event driven programming.

I am flexible with Python/C/C++ but prefer Python as this UART code is interfaced with other Python codes and having both in the same language makes it easier.

hello shravya.boggarapu1,

may I know what’s your actual use-case?

by default, we are using interrupts to handle UART Rx/Tx data in linux.
you should also check below public sources for reference,
$L4T_Sources/r32.5/Linux_for_Tegra/source/public/kernel/kernel-4.9/drivers/tty/serial/serial-tegra.c

there’s an Interrupt Enable Register (IER) for each UART. the Interrupt Enable Register(s) masks the incoming interrupts from the receiver ready, transmitter empty, line status, and modem status registers to the INT output pin.
it shows an example to enable Rx interrupts by writing IER register. please check Topic 166269 as see-also,
thanks

1 Like

Hi,
I am not sure I am liberty to tell as it is for my company product. I’ll try to describe it to help you get an idea.
We are running some ML algorithms on Nano while another microcontroller is handling some sensors. The microcontroller needs to interrupt the process running on Nano based on some sensor data. The communication between Nano and the microcontroller is through UART

I will look into the post that you mentioned. \

Thanks

FYI, much will depend on whether the UART goes through a USB cable. If it does, then the USB itself will force use of interrupt. UARTs themselves are capable (see what @JerryChang says) of being manually controlled by something other than IRQ polling, but USB is not. I couldn’t tell you what is needed to manually operate the UART, but I am emphasizing that anything USB in the UART chain will be a guaranteed defeat when trying to operate without IRQ polling.

@linuxdev I am not using a USB cable. I am using 8, 10 pins on the J41 header of the Nano and the UART pins of the microcontroller.

TBH, since the remainder of the code on Nano is in Python, I have been using the serial python library and it handles the data well but I have to keep checking if there’s any data waiting. I think the final code would be in C/C++ so @JerryChang 's method is good. I don’t want to depend on it too much on the python code. I am still in the process of coding though.

In case I run into any issues, I’ll reply to this post again

Thank you for you input

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