I am trying to read/write over UART from linux directly. I can read message on both UARTs (0 and 2), when sent from pc via real-term. I use cat /dev/ttyLP* to read port and it works fine however when I send using echo nothing is sent. Device tree config seems to be good, I am using the default one.
The linux user (torizon) has permission to write.
Is there something that I am missing?
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
Based on the context provided, it seems like you are encountering an issue with sending data over UART using the echo
command. Here are a few things you might want to check or try:
-
Command Syntax: Ensure that you are using the correct syntax for the
echo
command. For example, try usingecho -n "message" > /dev/ttyLP0
to avoid sending a newline character, which can sometimes disrupt communication. -
UART Settings: Double-check that the UART settings (such as baud rate, parity, and stop bits) are correctly configured and match between the sending and receiving devices. Mismatched settings can lead to communication failures.
-
Alternative Methods: If the issue persists, consider using other methods or tools for sending data. Tools like
printf
,minicom
, orscreen
might provide more control and feedback for debugging the issue.
If these suggestions do not resolve the issue, there might be other underlying problems not covered in the provided context.
Please, also check if these links can help you solve your problem:
How to use UART 1 in Colibri IMX8DX WB with viola carrier board?.
Hey @faizrehman,
I believe I understand, can you verify my thinking. I have a different module currently setup, so the node names in /dev/ names are different, but it should be the same fundamentals.
On your host computer you are preforming something like
host: echo -n "message" > /dev/ttyUSB3
and prior to the host command, you are running
on module: cat /dev/ttymxc*
This actually produced no message for me. I had to verify some settings of the modules /dev/ttymxc2 port via stty -F /dev/ttymxc2 115200 cs8 -cstopb -parenb
and then specifically read cat /dev/ttymxc2
-Eric
Hi @eric.tx,
I was able to figure out the issue, it was my usb-ttl cable.
In my setup, I had Colibri IMx8x connected to pc via USB to TTL cable, and pc with real-term running.
Test 1: I ran cat /dev/ttyLP0 on Colibri, and sent an arbitrary string (“Hello from PC”) from real-term. As expected I read it in colibri.
Test 2: Send command echo -n “Hello from Colibri” > /dev/ttyLP0. I saw the string received on real-term on my pc.
The issue was in sending command from colibri to pc and reason was the fault cable.
Thank you
Hi @eric.tx,
I found the issue. It was the TX wire (cable).