Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Apr 2022 16:39:18 +0400
From:      Alexander Mishin <mishin@mh.net.ru>
To:        freebsd-arm@freebsd.org
Subject:   Extra uarts to Rpi4b 8Gb do not work
Message-ID:  <5b5832ae7bd3f3b642815d179a56ab3a@mh.net.ru>

next in thread | raw e-mail | index | archive | help
Hi,

I tried adding extra serial ports on my Raspberry pi 4b 8Gb rev 1.4 for 
a gpio GPS module - the GPS module connected to uart0 (as well as uart1) 
is preventing the Raspberry from booting up. I even see dev/ttyu* files 
for added uarts after reboot, but uarts don't work for me.

My os-version:
FreeBSD 13.1-STABLE #3 stable/13-n250037-7d59a9451d3b: Sun Mar 20 
00:51:26 +04 2022 arm64

I copied uart4.dtbo and uart5.dtbo from rpi-firmware package to 
/boot/dtb/overlays directory (and to /boot/msdos/overlays. Don't know 
for sure which folder is being used) and added to /boot/msdos/config.txt 
to [All] section:
---
dtoverlay=uart4
gpio=8,9=a4
dtoverlay=uart5
gpio=12,13=a4
---

I then rebooted my system, checked that the /dev/ttyu(0,1,2) files are 
exist (uart0 is worked correctly) and checked pins configuration:
---
# gpioctl -l | egrep "pin (08|09|12|13|14|15)"
pin 08:	1	pin 8<>
pin 09:	1	pin 9<>
pin 12:	1	pin 12<>
pin 13:	1	pin 13<>
pin 14:	1	pin 14<>
pin 15:	1	pin 15<>
---

Then I connecteded the loops to the following pairs of pins: 8,10 (gpio 
14,15), 21,24 (gpio 9,8) and 32,33 (gpio 12,13) and ran a script I found 
somewhere on the Internet when I was looking for a solution to my issue:
---
import serial
import time
test_string = "[serial port test]".encode('utf-8')
port_list = ["/dev/ttyu0", "/dev/ttyu1", "/dev/ttyu2" ]
for port in port_list:
   ok = False
   try:
     buff = bytearray(len(test_string))
     serialPort = serial.Serial(port, 115200, timeout = 2, writeTimeout = 
2)
     bytes_sent = serialPort.write(test_string)
     time.sleep(1)
     bytes_read = serialPort.readinto(buff)
     ok = bytes_read == bytes_sent
     serialPort.close()
   except IOError:
     pass
   print("port %s is %s" % (port, "OK" if ok else "NOT OK"))
---

I get the result:
---
port /dev/ttyu0 is OK
port /dev/ttyu1 is NOT OK
port /dev/ttyu2 is NOT OK
---

Did I make a mistake in my actions? Is it possible to add extra uarts to 
rpi4b at all?

Thanks



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5b5832ae7bd3f3b642815d179a56ab3a>