Can't get UART on vim4

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu 22.04

Which version of system do you use? Khadas official images, self built images, or others?

Khadas official images Ubunut 22.04

Please describe your issue below:

Sorry for a bit long-worn topic but all my efforts to get UART on khadas vim4 have failed.

I have two systems. One vim4 and the second x86 host.
vim4 configured according wiki VIM4 UART [Khadas Docs] and I’ve even tried to follow by VIM4 Setup Serial Debug Console [Khadas Docs]

Looks like vim4 configured right
vim4

cat /boot/dtb/amlogic/kvim4.dtb.overlay.env
fdt_overlays=uart_e
dmesg | grep uart| grep  tty
[    1.905243] fe078000.serial: ttyS0 at MMIO 0xfe078000 (irq = 55, base_baud = 1500000) is a meson_uart
[    2.794609] fe07c000.serial: ttyS1 at MMIO 0xfe07c000 (irq = 56, base_baud = 1500000) is a meson_uart
[    2.796420] fe080000.serial: ttyS4 at MMIO 0xfe080000 (irq = 57, base_baud = 1500000) is a meson_uart

UART usb-to-uart based on FT232RL

I’ve tried to use

on x86 host side picocom --flow hoff -b 115200 /dev/ttyUSB0 and even checked by minicom -s too

I’ve built uart.c with ttyS4 and additionally with ttyUSB0 (on x86 side)

Tried echo -n -e "TEST" > /dev/ttyS4 (vim4 side) and echo -n -e "TEST" > /dev/ttyUSB0 (x86 side) but culdn’t see anything.

Couldn’t see anything in picocom, minicom, uart with ttyUSB0 and ttyS4.

Questions:

  1. What the difference between LINUX_RX/TX and UART_e_RX/TX ?
  2. What am I doing wrong ?

Post a console log of your issue below:


**Delete this line and post your log here.**

Hello @Black.S

@Electr1 please help to check this issue.

Hello @Black.S

please check out the usage of stty

khadas@Khadas:~$ sudo stty -F /dev/ttyS4 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>;
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany
-imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
-flusho -extproc

it seems your issue can be related to the uart baud rate. I can use 9600 baud rate and receive from the VIM4 without issue as mention in the dumped info.

This is for the uart_e usage,
if you need to increase the speed of the uart you need to run

sudo stty -F /dev/ttyS 115200

for 115200 baud rate.

For Linux uart, the default speed is set at 921600.

Regards.

Hello @Electr1,
Thanks for your answer

stty -F /dev/ttyS4 -a
speed 921600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

my picocom configs

root@x86_host:~# picocom --flow hoff -b 921600 /dev/ttyUSB0
picocom v3.1

port is        : /dev/ttyUSB0
flowcontrol    : RTS/CTS
baudrate is    : 921600
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

Type [C-a] [C-h] to see available commands
Terminal ready

I’ve tried but don’t have any effect.
x86 side
picocom --flow hoff -b 115200 /dev/ttyUSB0
picocom --flow hoff -b 921600 /dev/ttyUSB0
minicom -s -b 921600

vim4 side

root@vim4:~# echo -e -n "ssssssssss" > /dev/ttyS4
root@vim4:~# ./uart_ttyS4
asdasdfasdfasdf
123

And can you clarify which UART should I use LINUX_RX/TX or UART_e_RX/TX ?
And why we have two UARTs in one board ?
Is LINUX_RX/TX the same UART_e_RX/TX ?

@Black.S

you need to use uart_e TX/RX for using /dev/ttyS4.

Linux uart is for debugging the board, procuring logs, sending commands by tty shell

uart_e is the general purpose uart of VIM4, you can use this for your application, communication with peripherals etc.

they are not the same, you can check the GPIO pinout

image

/dev/ttyS0 → linux uart
/dev/ttyS4 → uart_e

Regards.

I’ve tried all of these but still hasn’t success.
May I have other limitations ? Like a unconfigured GPIO or something else ?
Which additional things can be checked to know that all subsystems works well ?

@Black.S please check the wiring, maybe your connections are swapped. If your ttl convertor has led indicators for data transmission, check if the right leds are blinking

You can also try connecting the uart_e and USB port of the vim4 itself and test if sending data through /dev/ttyS4 reaches/dev/ttyUSB0.

The interesting solution. Thank you. Will try.