Tinker Board Forum

Full Version: UART
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've same problems to use UART4 on Tinker Board.
I don't understand the criterion used for the association between UART and symbolic names in Linux, but I see that
UART1 is ttyS1, UART2 is ttyS2 and UART3 is ttyS3. For this reason I thought UART4 was ttyS4 but it isn't present.
The UART4 is enabled on hw_intf.conf
which is so set:

intf: spi2=on

If I execute gpio readall command I see that pin 13 and 15 isn't set as SERL but are IN.
How I can set they to SERL? I have read that it is a customization for ASUS and is not present as a mode in wiringPI.

Thank you in advance!
There are some bugs about setting uart4 by hw_intf.conf that the pin setting is wrong in the device tree.
The bug will be fixed in next version of image. (https://www.asus.com/tw/Single-Board-Com..._Download/)

You can manually change the pin function by wiringPi or gpio. The methods are shown as following.
(Before using the wiringPi or gpio, It is best to update the wiringPi library by downloading the source code from https://github.com/TinkerBoard/gpio_lib_c and building it.)

Method 1: wiringPi
#include <wiringPi.h>
int main()
   //FSEL_INPT(0), FSEL_OUTP(1), FSEL_ALT0(4, func1), FSEL_ALT1(5, func2), FSEL_ALT2(6, func3), FSEL_ALT3(7, func4), FSEL_ALT4(3) or FSEL_ALT5(2)
   pinModeAlt(13, 6);    //UART4TX: ALT2, func3 http://opensource.rock-chips.com/images/...170301.pdf Page 45
   pinModeAlt(15, 6);    //UART4RX: ALT2, func3 http://opensource.rock-chips.com/images/...170301.pdf Page 45
   return 0;

Method 2: gpio
gpio -1 mode 13 alt2
gpio -1 mode 15 alt2
Hi, Ecce
thank you very much!
I've been able to set pin mode to SERL (the gpio utility downloaded from official server is the same version 2.3.1 but have ALT mode disabled).
The problem now is that I don't have ttyS4 on device list. If I look but address 0xFF1C0000 is not accessible.
How I can resolve this problem? Do I need to recompile the kernel?
Hi, LArmstrong1985

There are some bugs about UART in debian_kernel.
You can recompile the kernel or wait for the new image updated.
Next, I will show the bugs about UART.
1. Maximum number of serial ports() are 4, so the ttyS4 are not generated. 
Fix: drivers/tty/serial/8250/Kconfig (https://github.com/TinkerBoard/debian_ke...50/Kconfig)
Line 138:
config SERIAL_8250_NR_UARTS
int "Maximum number of 8250/16550 serial ports"
depends on SERIAL_8250
default "4"  ==> default "5"

Line 148:
int "Number of 8250/16550 serial ports to register at runtime"
depends on SERIAL_8250
range 0 SERIAL_8250_NR_UARTS
default "4"  ==> default "5"

2. It is not work to set the gpio as UART by hw_intf.conf. The reason is that the pin setting is wrong.
Fix: arch/arm/boot/dts/rk3288.dtsi (https://github.com/TinkerBoard/debian_ke...8.dtsi#L10)
Line 2139:
uart4 {
uart4_xfer: uart4-xfer {
rockchip,pins = <5 12 3 &pcfg_pull_up>, ==> 5 12(gpio5_B4/uart4ex_ctsn)
                       <5 13 3 &pcfg_pull_none>; ==> 5 13(gpio5_B5/uart4ex_rtsn)
uart4_cts: uart4-cts {
rockchip,pins = <5 14 3 &pcfg_pull_up>; ==> 5 12(gpio5_B6/uart4exp_sout)
uart4_rts: uart4-rts {
rockchip,pins = <5 15 3 &pcfg_pull_none>; ==> 5 12(gpio5_B7/uart4exp_sin)

Reference: http://opensource.rock-chips.com/images/...170301.pdf (Page: 45)

The correct version:
uart4 {
uart4_xfer: uart4-xfer {
rockchip,pins = <5 15 3 &pcfg_pull_up>,
                       <5 14 3 &pcfg_pull_none>;
uart4_cts: uart4-cts {
rockchip,pins = <5 12 3 &pcfg_pull_up>;
uart4_rts: uart4-rts {
rockchip,pins = <5 13 3 &pcfg_pull_none>; 

BTW, I'm sorry about the issue.