Jump to content

Accessing UART4 on RockPro64


Go to solution Solved by antonlyap,

Recommended Posts

Posted
Armbianmonitor:

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

rock64@rockpro64:~$ sudo picocom -b 115200 /dev/ttyS4
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

 

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:

#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");
}

 

I have tried using different kernels (including dev) and switching between different combinations of overlays (UART4 and SPI1 share the same pins on RockPro64). The RockPro64 itself is booting from an eMMC module, the SPI flash contains U-Boot for USB and PXE boot support.

 

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

Posted

Yes, I did, check out the armbianmonitor -u output link:

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

 

Posted
2 hours ago, antonlyap said:

the SPI flash contains U-Boot for USB and PXE boot support

What is this u-boot's source?

Does it have overlays support enabled (CONFIG_OF_LIBFDT_OVERLAY)?

 

Can you also verify if you have uart4 overlay in your filesystem?

root@rockpro64:~# ll /boot/dtb/rockchip/overlay/rockchip-uart4.dtbo
-rwxr-xr-x 1 root root 384 Sep  4 18:23 /boot/dtb/rockchip/overlay/rockchip-uart4.dtbo*

 

Your dmesg still contains spi-nor entry so either there is no uart4 overlay or it is not applied.

[    4.152295] spi-nor spi0.0: gd25q128 (16384 Kbytes)

 

  • Solution
Posted

Thanks for your message! Actually, it turns out that U-Boot is the source of the problem. I erased the SPI flash and now, when booting directly from eMMC, UART4 does get initialized. Here is the new output from armbianmonitor -u: http://ix.io/2zIr.
When connecting to the serial port though, I get some garbage output instead of the ping messages I'm supposed to get. The baudrate is matched on both sides, what else could be wrong with my settings?

Posted

It worked after changing the baud rate on both sides to 9600. I'm not sure why it didn't work with 115200 baud - probably the problem is on the Attiny side, I just read that SoftwareSerial doesn't work well with high baud rates. Anyway, thanks everyone for your help, it is appreciated

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines