I am working with a Particle Tachyon and trying to use the hardware UART (UART1_TXD on Pin 8, UART1_RXD on Pin 10) to communicate with a Particle Boron.
I have confirmed my wiring is correct (TX->RX, RX->TX, common GND). When I list the devices in /dev/, I see several ttyHS* ports, but none of them seem to correspond to the pins on the 40-pin header. My Python script using pyserial fails to open or get data from any of them.
This leads me to believe that UART1 is disabled by default in the Device Tree. Could you please point me to the documentation or provide the command/procedure required to enable UART1 on the GPIO header so it can be accessed from Linux (e.g., as /dev/ttyHS0)? Unless it is already enabled by default, then I am at a loss.
So, this uart is mapped already at: /dev/ttyHS2 Works well as we have demos using it.
A helpful command to see which GPIOs are mapped is:
cat /sys/kernel/debug/pinctrl/*/pinmux-pins
The output contains:
pin 34 (GPIO_34): a80000.qcom,qup_uart (GPIO UNCLAIMED) function gpio group gpio34
pin 35 (GPIO_35): a80000.qcom,qup_uart (GPIO UNCLAIMED) function gpio group gpio35
Thank you for the information about the UART being enabled by default and using /dev/ttyHS2.
I've spent the evening running detailed tests and have unfortunately hit a wall.
To isolate the issue, I performed UART loopback tests (connecting TX directly to RX) on both my Boron and my Tachyon independently.
Boron Loopback Test (TX to RX):PASSED. The Boron can successfully send and receive data on its Serial1 port without any issues. This confirms my Boron's hardware is working correctly.
Tachyon Loopback Test (Pin 8 TXD to Pin 10 RXD):FAILED.
I have a jumper wire connecting Pin 8 to Pin 10.
The Python script successfully opens /dev/ttyHS2.
The ser.write() command executes without error.
However, ser.readline() consistently returns empty. No data is ever received.
Hey there
below is my code to confirm it works after short pin8 and pin10 through a jumper wire.
my desktop version is 1.0.129
you can also check yours by runningcat /etc/particle/distro_versions.json
import time
import serial as ser
if __name__=="__main__":
uart = ser.Serial('/dev/ttyHS2',timeout=10)
while True:
uart.write('Hello world\r\n'.encode('utf-8'))
print(uart.readline())
'''
rsp = uart.read_until(b'\r\n')
if rsp:
print(rsp)
uart.write(rsp)
'''
if it still cannot work, then I would suggest run ls -l /dev/ttyHS2 to see user belongs to dialout group or not
if you didnot see something like crw-rw---- 1 root dialout 234, 2 Jun 11 15:32 /dev/ttyHS2 then it may means it's a group issue.
run sudo usermod -aG dialout $USER to add user into that group
after above comand. do a reboot before run this python script again
Thank you both for the reply. Still bad news though.
I ran the stty -F command and then opened minicom.
Typing showed nothing (I turned on echo to verify the keyboard was at least sending commands and no double lettering.)
Checked minicom's settings and noticed Hardware Flow Control was ON. Just for kicks I went through every combination of HW/SW on's and off's. Never saw any text I typed.
Then checked my particle version (also 1.0.129). Created a test.py script with the code from ericyuan...ten seconds or so later a slow stream of empty byte strings: b' ' .
Just to make sure it isn't me and that I haven't done something obviously dumb, we are talking jumpers on the 4th and 5th pins on the right hand side correct? (I've made dumber mistakes than miscounting)
Lol thank you for the photo! I was looking at the board with the text bring right side up, therefore having the wrong pins (going to go correct my mistake and report back.). That's why I ask the "dumb" questions.