UART on 40Pin Header not working
Hi
I'm using the UP Squared Pro 7000 board and I want to read serial data through the 40Pin Header. I have a simple test setup where I use an Arduino Nano Every to send serial data every 500ms to the UP Squared. I have connected the Nano Every RX to the UP Squared TX (Pin8, UART1_TX) and the Nano Every TX to the UP Squared RX (Pin10, UART1_RX). The Arduino Nano Every is not connected to a PC.
I'm running Ubuntu 22.04.3 LTS (Jammy) using the following Intel IoT Kernel:
uname -a Linux up-hb002 5.15.0-1043-intel-iotg #49-Ubuntu SMP Wed Oct 11 17:41:04 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
As written here it should be possible to run an Ubuntu original kernel and then install pinctrl
on top: https://forum.up-community.org/discussion/5126/ubuntu-22-04-with-kernel-5-4
That's what I did according to the instructions here: https://github.com/up-division/pinctrl-upboard
I then tried to read the serial data both with the screen
command and with the below attached python script (tried ttyS4 and ttyS5).
sudo screen /dev/ttyS4 115200
Unfortunately, I'm not able to read the serial data neither with the screen
command nor using the python script. Any advice? Thank you very much.
Arduino Nano Every code:
int counter; void setup() { counter = 0; Serial.begin(115200); } void loop() { while (true) { Serial.print("counter="); Serial.println(counter); counter++; delay(500); } }
UP Squared code, python script:
import serial with serial.Serial('/dev/ttyS4', 19200, timeout=1) as ser: print(ser.readline()) # read a '\n' terminated line
Further information:
sudo dmesg | grep tty [ 0.071624] printk: console [tty0] enabled [ 0.477804] 00:01: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A [ 0.506780] 00:02: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A [ 14.532896] dw-apb-uart.4: ttyS4 at MMIO 0x4017004000 (irq = 16, base_baud = 6250000) is a 16550A [ 14.577957] dw-apb-uart.5: ttyS5 at MMIO 0x4017005000 (irq = 17, base_baud = 6250000) is a 16550A
Answers
-
I solved it now by sending the data on the right serial port
Serial1
on the Arduino Nano Every side with the following code:int counter; void setup() { counter = 0; Serial1.begin(115200); } void loop() { Serial1.print("counter="); Serial1.println(counter); counter++; delay(500); }