PINE64
Accessing UART4 on RockPro64 (Armbian) - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: ROCKPRO64 (https://forum.pine64.org/forumdisplay.php?fid=98)
+--- Forum: Linux on RockPro64 (https://forum.pine64.org/forumdisplay.php?fid=101)
+--- Thread: Accessing UART4 on RockPro64 (Armbian) (/showthread.php?tid=11166)



Accessing UART4 on RockPro64 (Armbian) - antonlyap - 08-27-2020

Hi there! I am trying to set up communication between an Attiny85 and my RockPro64 over UART (running Armbian, kernel `Linux rockpro64 5.7.15-rockchip64 #20.08 SMP PREEMPT Mon Aug 17 00:26:28 CEST 2020 aarch64 aarch64 aarch64 GNU/Linux`). The issue is that I can't connect to the serial port:

Code:
rock64@rockpro64:~$ sudo picocom -b 115200 /dev/ttyS4 [sudo] password for rock64: picocom v3.1 port is        : /dev/ttyS4 flowcontrol    : none baudrate is    : 115200 parity is      : none databits are   : 8 stopbits are   : 1 escape is      : C-a local echo is  : no noinit is      : no noreset is     : no hangup is      : no nolock is      : no send_cmd is    : sz -vv receive_cmd is : rz -vv -E imap is        : omap is        : emap is        : crcrlf,delbs, logfile is     : none initstring     : none exit_after is  : not set exit is        : no FATAL: failed to add port: Filedes is not a tty


I can see that UART4 is not initialized on boot:

Code:
rock64@rockpro64:~$ dmesg | grep tty [    0.000000] Kernel command line: mmc_cmdqueue=0 earlycon=uart8250,mmio32,0xff1a0000 root=UUID=73fac48d-4f73-4ac1-b899-e67dc98b5794 rootwait rootfstype=ext4 console=ttyS2,1500000 console=tty1 consoleblank=0 loglevel=1 ubootpart=f499ef85-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1 [    0.001600] printk: console [tty1] enabled [    4.089584] ff180000.serial: ttyS0 at MMIO 0xff180000 (irq = 38, base_baud = 1500000) is a 16550A [    4.089974] serial serial0: tty port ttyS0 registered [    4.091686] ff1a0000.serial: ttyS2 at MMIO 0xff1a0000 (irq = 39, base_baud = 1500000) is a 16550A [    4.092153] printk: console [ttyS2] enabled [   10.755654] systemd[1]: Created slice system-serial\x2dgetty.slice. [   14.723780] systemd[1]: Found device /dev/ttyS2.
Even though it is enabled as an overlay:

Code:
rock64@rockpro64:~$ cat /boot/armbianEnv.txt verbosity=1 bootlogo=false overlay_prefix=rockchip rootdev=UUID=73fac48d-4f73-4ac1-b899-e67dc98b5794 rootfstype=ext4 overlays=uart4 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u




If this is helpful - here are some details about my setup:

An Attiny85 is powered from a 3V coin cell. Here is the wiring:
  • Battery positive - Attiny85 pin 8
  • Battery negative - Attiny85 pin 4 - RockPro64 ground on GPIO pin 6
  • Attiny85 pin 6 (PB1) - RockPro64 UART4_RX on GPIO pin 21 (connected through a 1K current-limiting resistor)
  • UART4_TX is not connected because currently I only need unidirectional communication
I used Arduino IDE with a USBtinyISP programmer to program my Attiny85 with the following test code:

Code:
#include <SoftwareSerial.h> #define RX 0 #define TX 1 SoftwareSerial serial(RX, TX); void setup() {   // put your setup code here, to run once:   serial.begin(115200); } void loop() {   // put your main code here, to run repeatedly:   serial.println("ping"); }


Is there any way I can fix this issue? Are there any other easy-to-use alternatives to UART for establishing bidirectional communication? Any help is appreciated!



Thanks,

Anton


RE: Accessing UART4 on RockPro64 (Armbian) - antonlyap - 10-04-2020

I have just found a solution. In case anyone is interested, here is the link: https://forum.armbian.com/topic/15419-accessing-uart4-on-rockpro64/.
TLDR:
- In order to make the UART4 overlay load, I had to erase the SPI flash and boot directly from the eMMC because SPI1 and UART4 share the same pins
- If you are using the SoftwareSerial library on an Arduino or something similar, you need to use lower baud rates (e. g. 9600) to make the communication reliable