yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
RDK X3 Board📖
1. RDK X3 Board Introduction
  • 1.1 About RDK X3 board
  • 1.2 Write system
  • 1.3 SD expansion
  • 1.4 Hardware interface
  • 1.5 Install case antenna
2. Basic setting
  • 2.1 Network Configuration
  • 2.2 Remote Login
  • 2.3 System Update
  • 2.4 Configure srpi-config
  • 2.5 confit.txt file
  • 2.6 Thermal control-CPU frequency
  • 2.7 Auto-start at boot
  • 2.8 RDK-specific commands usage
  • 2.9 Linux command usage
  • 2.10 GPIO read write
  • 2.11 Image classification algorithm
  • 2.12 USB camera usage
  • 2.13 MIPI camera uasge
3. Basic course
C language
  • 1. Camera image display
  • 2. Save camera image
  • 3. Camera image encoding
  • 4. Video decoding display
  • 5. VPS scaling example
  • 6. Object detection algorithm-fcos
  • 7. Object detection algorithm—YOLOv5
Python
  • 1. Using GPIO
  • 2. Using PWM
  • 3. Using serial port
  • 4. Using I2C
  • 5. Using SPI
Download
  • Image_system
  • Code
  • Software_Tools
Download ZIP

Welcome to RDK X3 Board repository

3. Using serial port

Using serial port

Using serial port1. Code path2. Loopback test3. Test code

1. Code path

RDK X3 enables UART3 on 40pin by default, physical pins 8 and 10, IO voltage 3.3V.

RDK Ultra enables UART2 on 40pin by default, physical pins 8 and 10, IO voltage 3.3V.

Please refer to /app/40pin_samples/test_serial.py for details on how to use the serial port.

2. Loopback test

Connect TXD and RXD in hardware.

Then, run the test program to perform write and read operations. The expected result is that the read data is exactly the same as the written data.

  • Hardware Hookup

Connect TXD and RXD together directly through the jumper cap.

image-20220512101820743

  • Test process

  • Run python3 /app/40pin_samples/test_serial.py

  • Select the bus number and chip select number from the printed serial port device (/dev/ttyS0 is the system debug port. It is not recommended to test it unless you fully understand its function).

    For example, select test /dev/ttyS3, press Enter to confirm, and enter the baud rate parameter.

x
List of enabled UART:
/dev/ttyS0  /dev/ttyS1  /dev/ttyS3  /dev/ttyUSB0

Please input the serial port device name to be tested: /dev/ttyS3
Please input the baud rate(9600,19200,38400,57600,115200,921600):921600
Serial<id=0x7f819dcac0, open=True>(port='/dev/ttyS3', baudrate=921600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)
  • When the program runs correctly, it will continue to print Send: AA55 and Recv: AA55:
xxxxxxxxxx
Starting demo now! Press CTRL+C to exit
Send:  AA55
Recv:  AA55

运行

3. Test code

x
#!/usr/bin/env python3

import sys
import os
import time

# Import Python serial port library
import serial
import serial.tools.list_ports

def serialTest():
    print("List of enabled UART:")
    os.system('ls /dev/tty[a-zA-Z]*')
    uart_dev= input("Please input the name of the serial port device to be tested:")

    baudrate = input("Please enter the baud rate(9600,19200,38400,57600,115200,921600):")
    try:
        ser = serial.Serial(uart_dev, int(baudrate), timeout=1) # 1s timeout
    except Exception as e:
        print("open serial failed!\n")

    print(ser)

    print("Starting demo now! Press CTRL+C to exit")

    while True:
        test_data = "AA55"
        write_num = ser.write(test_data.encode('UTF-8'))
        print("Send: ", test_data)

        received_data = ser.read(write_num).decode('UTF-8')
        print("Recv: ", received_data)

        time.sleep(1)

    ser.close()
    return 0


if __name__ == '__main__':
    if serialTest() != 0:
        print("Serial test failed!")
    else:
        print("Serial test success!")
Using PWM
Using I2C

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文