Kickpi-Book
  • KICKPI Document
  • K5/K5C(A133)
    • A133中文文档
      • 01-主板介绍
        • 01-KICKPI-K5硬件介绍
        • 02-KICKPI-K5C硬件介绍
      • 02-入门必读
        • 01-网盘目录说明
        • 02-快速使用
        • 03-功能测试
        • 04-扩展引脚
      • 03-镜像烧录
        • 01-获取镜像文件
        • 02-SD卡烧录
        • 02-USB线烧录
      • 04-SDK编译
        • 01-编译环境搭建
        • 02-LINUX_SDK源码编译
        • 03-ANDROID_SDK源码编译
      • 05-外设驱动
        • LCD功能调试
        • LRADC按键配置
      • 06-ANDROID系统定制
        • 01-Android常用系统定制
      • 07-LINUX系统定制
        • 02-Linux常用系统定制
      • 08-进阶
        • K5C主板供电
        • 安卓休眠唤醒
        • 13-硬件工厂测试
    • en
      • 01-Development_board_Introduction
        • 01-KICKPI-K5_Hardware_Introduction
        • 02-KICKPI-K5C_Hardware_Introduction
      • 02-Getting_Started_Guide
        • 01-KICKPI_Cloud_Storage_Introduction
        • 02-Quick_Start_Guide
        • 03-Functional_Testing
        • 04-Expansion_Pins_Testing
      • 03-Image_Flashing_Guide
        • 01-How_to_Get_Image_File
        • 02-SD Card Burning
        • 03-USB_Cable_Flashing
      • 04-SDK_Compilation_Guide
        • 01-Compilation_Environment_Setup
        • 02-Linux_SDK_Compilation
        • 03-Android_SDK_Compilation
      • 06-Android_System_Customization
        • 01-Android_Common_System_Customization
      • 07-Linux_System_Customization
        • ADB_Tutorial
  • K2B/K2C(H618)
    • en
      • 01-Development_board_Introduction
        • 01-KICKPI-K2B_Hardware_Introduction
        • 02-KICKPI-K2B_Hardware_Introduction
      • 02-Getting_Started_Guide
        • 01-KICKPI_Cloud_Storage_Introduction
        • 02-Quick_Start_Guide
        • 03-Functional_Testing
        • 04-Expansion_Pins_Testing
      • 03-Image_Flashing_Guide
        • 01-SD_Card_Flashing
        • 02-USB_Cable_Flashing
      • 04-SDK_Compilation_Guide
        • 01-Compilation_Environment_Setup
        • 02-Linux_SDK_Compilation
        • 03-Android_SDK_Compilation
      • 05-Drivers_Development
        • RTC
      • 06-Android_System_Customization
        • 01-Android_Common_System_Customization
      • 07-Linux_System_Customization
        • 01-Linux_Common_System_Customization
      • 08-Advanced_Topics
        • Hardware_Factory_Testing
        • Keybox
    • zh
      • 01-主板介绍
        • 01-KICKPI-K2B硬件介绍
        • 02-KICKPI-K2C硬件介绍
      • 02-入门必读
        • 01-网盘目录说明
        • 02-快速使用
        • 03-功能测试
        • 04-扩展引脚
      • 03-镜像烧录
        • 01-SD卡烧录
        • 02-USB线烧录
      • 04-SDK编译
        • 01-编译环境搭建
        • 02-LINUX_SDK源码编译
        • 2. Android SDK编译
      • 05-外设驱动
        • RTC
      • 06-Android系统定制
        • Android常用系统定制
      • 07-Linux系统定制
        • 01-Linux常用系统定制
        • 02-Linux_QT开发环境搭建
      • 08-进阶
        • Keybox
        • Secure Boot
        • Windows_QT开发环境搭建
        • 扩展引脚功能定制
        • 硬件工厂测试
  • K1/K1B/K3/K8(RK356x-RK3588)
    • en
      • 01-Development_board_Introduction
        • 01-RK_Chip_Comparison_Introduction
        • 02-KICKPI-K1_Hardware_Introduction
        • 03-KICKPI-K1B_Hardware_Introduction
        • 04-KICKPI-K3_Hardware_Introduction
        • 05-KICKPI-K8_Hardware_Introduction
      • 02-Getting_Started_Guide
        • 01-Cloud_Storage_Directory_Description
        • 02-K1-Quick_Start_Guide
        • 02-K1B-Quick_Start_Guide
        • 02-K3-Quick_Start_Guide
        • 02-K8-Quick_Start_Guide
        • 03-Functional_Testing
        • 04-Expansion_Pins
      • 03-Image_Flashing_Guide
        • 01-USB_Cable_Flashing
      • 04-SDK_Compilation_Guide
        • 01-Compilation_Environment_Setup
        • 02-LINUX_SDK_Compilation
        • 03-ANDROID_SDK_Compilation
      • 05-Drivers_Development
        • GPIO
        • Kernel
        • LCD
        • PWM
        • RTC
      • 06-Android_System_Customization
        • 01-Common_Android_System_Customizations
        • 01-Common_Android_System_Customizations
      • 07-Linux_System_Customization
        • 01-Common_Linux_System_Customization
        • 02-Installing_VNC_on_Linux
        • 03-Linux_Docker
        • 04-Linux_QT_Environment_Setup
        • 05-Linux_NPU_YOLOV5S_object_detection
      • 08-Advanced_Topics
        • 01-Hardware_Factory_Test
        • 02-Hardware_Aging_Test
        • 03-Firmware_Unpacking_and_Packing
    • zh
      • 01-主板介绍
        • 01-RK芯片对比介绍
        • 02-KICKPI-K1硬件介绍
        • 03-KICKPI-K1B硬件介绍
        • 04-KICKPI-K3硬件介绍
        • 05-KICKPI-K8硬件介绍
      • 02-入门必读
        • 01-网盘目录说明
        • 02-K1-快速使用
        • 02-K1B-快速使用
        • 02-K3-快速使用
        • 02-K8-快速使用
        • 03-功能测试
        • 04-拓展引脚
      • 03-镜像烧录
        • 01-获取镜像文件
        • 02-USB线烧录
      • 04-SDK编译
        • 01-编译环境搭建
        • 02-LINUX_SDK编译
        • 03-ANDROID_SDK编译
      • 05-外设驱动
        • GPIO
        • Kernel
        • LCD
        • PWM
        • RTC
      • 06-ANDROID系统定制
        • 01-Android常用系统定制
        • 07-Android NPU YOLOV5 目标检测
      • 07-LINUX系统定制
        • 01-Linux常用系统定制
        • 02-Linux安装VNC
        • 03-Linux Docker环境搭建
        • 04-Linux QT环境搭建
        • 05-Linux NPU YOLOV5S 目标检测
      • 08-进阶
        • 01-硬件工厂测试
        • 02-硬件老化测试
        • 03-固件解包和打包
  • K7(RK3576)
    • en
      • 01-Development_board_Introduction
        • 01-KICKPI-K7_Hardware_Introduction
      • 02-Getting_Started_Guide
        • 01-KICKPI_Cloud_Storage_Introduction
        • 02-Quick_Start_Guide
        • 03-Functional_Testing
        • 04-Expansion_Pins_Testing
      • 03-Image_Flashing_Guide
        • 01-How_to_Get_Image_File
        • 02-USB_Cable_Flashing
      • 04-SDK_Compilation_Guide
        • 01-Compilation_Environment_Setup
        • 02-Linux_SDK_Compilation
        • 03-Android_SDK_Compilation
      • 05-Drivers_Development
        • ADC
        • PWM
      • 06-Android_System_Customization
        • 01-Android_Common_System_Customization
      • 07-Linux_System_Customization
        • 01-Linux_Common_System_Customization
        • 02-Linux_Docker_Environment_Setup
        • 03-Linux_NPU_YOLOv5s_Object_Detection
        • 04-Linux_DeepSeek_Large_Model
        • 05-Linux_VNC_Remote_Control
      • 08-Advanced_Topics
        • Advanced_Testing
    • zh
      • 01-主板介绍
        • 01-KICKPI-K7硬件介绍
      • 02-入门必读
        • 01-网盘目录说明
        • 02-快速使用
        • 03-功能测试
        • 04-拓展引脚
      • 03-镜像烧录
        • 01-获取镜像文件
        • 02-USB线烧录
      • 04-SDK编译
        • 01-编译环境搭建
        • 02-Linux_SDK编译
        • 03-Android_SDK编译
      • 05-外设驱动
        • ADC
        • PWM
      • 06-ANDROID系统定制
        • 01-Android常用系统定制
      • 07-LINUX系统定制
        • 01-Linux常用系统定制
        • 02-Linux Docker环境搭建
        • 03-Linux NPU YOLOV5S 目标检测
        • 04-Linux_Deepseek大模型
        • 05-Linux_VNC远程控制
      • 08-进阶
        • 进阶测试
  • K4B(T113-S3)
    • T113-S3中文文档
      • 01-KICKPI-K4B硬件介绍
      • 10-系统镜像烧录
      • 11-SDK源码编译
      • 12-硬件功能测试
      • 13-硬件工厂测试
      • LCD功能调试
      • 20-Ubuntu20.04系统定制
      • Buildroot_QT5配置
      • Buildroot系统定制
  • common
    • en
      • adb
        • ADB_Tutorial
      • allwinner_burnning
        • SD_Card_Flashing
        • USB_Cable_Flashing
      • debug
        • 01 - Log Collection
      • display
        • FPC_Interface_Introduction
      • linux
        • SSH
    • zh
      • adb
        • ADB教程
      • android
        • qt
      • debug
        • 01-日志抓取
        • 常见问题
      • display
        • FPC接口介绍
      • linux
        • SSH
        • VNC
        • qt
      • 全志烧录
        • SD卡烧录
        • USB线烧录
Powered by GitBook
On this page
  • Expansion Pins
  • K1 Pin List
  • K1B Pin List
  • K3 Pin List
  • K8 Pin List
  • GPIO
  • User-level Control of GPIO Level
  • UART
  • PWM
  • User-level Configuration of PWM Output
  • ADC
  • CAN
  • SPI
  1. K1/K1B/K3/K8(RK356x-RK3588)
  2. en
  3. 02-Getting_Started_Guide

04-Expansion_Pins

Last updated 4 days ago

Expansion Pins

K1 Pin List

image-20240420181207097

K1B Pin List

K3 Pin List

K8 Pin List

GPIO

Multiple controllable GPIOs are configured by default in the expansion pins of the development board.

User-level Control of GPIO Level

GPIOs configured in the default software expansion pins are generally registered for this type of control.

This method can control the pin to output a high or low level.

View the GPIO registration list

$ ls /sys/class/leds/

gpio1b0/ gpio1b2/ gpio1d4/ gpio3b6/ 
gpio1a4/ gpio1b1/ gpio1d0/ gpio3b5/ gpio4c4/

Control GPIO via the command line

$ echo 1 > /sys/class/leds/gpio3b6/brightness
$ echo 0 > /sys/class/leds/gpio3b6/brightness

UART

One or more UARTs are generally configured by default in the expansion pins of each series of boards. After connecting the corresponding UART to be used, you can perform tests as follows.

  • Confirm the serial port number to be used

Check if the corresponding node exists

$ ls /dev/ttyS*

For example, UART4 corresponds to /dev/ttyS4

Perform a communication test using microcom

Android has microcom installed by default.

$ microcom -s 115200 /dev/ttyS4

If the node found for serial port 4 is /dev/ttyS4

-s sets the baud rate to 115200

Verify using minicom:

It is recommended to use minicom on Linux.

Configuration is required for the first installation:

  • Use minicom -s to turn off Serial port setup >> F Hardware Flow Control.

  • Press the Esc key or Enter to return to the previous level and select Save setup as dfl to save.

  • Select Exit from Minicom to exit.

Use the following command:

$ minicom -b 9600 -D /dev/ttyS3

Default display: The received content will be printed, and the sent content will not be printed.

Press Ctrl+A to enter the control mode for commands from B to Z. Press Z for help.

Ctrl+A X
Exit the program

Ctrl+A W

Enable/disable auto line feed (disabled by default)

Ctrl+A E

Enable/disable input display (disabled by default)

Ctrl+A C

Clear the screen

Alternatively, use echo to send data directly

$ stty -F /dev/ttyAS3 -a 	// View the default baud rate
$ stty -F /dev/ttyAS3 115200 	// Set the baud rate
$ echo "123" > /dev/ttyAS3

PWM

The RK3568 has 4 PWM modules, and each PWM module has 4 channels of PWM, totaling 16 channels of PWM.

User-level Configuration of PWM Output

The Extend 40Pin interface includes multiple channels of PWM. Taking the PWM3 channel as an example, enter the PWM configuration according to the following commands.

After successfully setting the configuration parameters as shown in the example, you can use a multimeter to measure the PWM3 pin, and the correct voltage should be around 1.6V.

Example: Set the PWM3 channel with a period of 10000ns, a duty cycle of 5000ns, and a polarity of normal.

The PWM path is /sys/class/pwm, and pwmchip* is numbered starting from 0 according to the enabling order. The following shows the settings for pwmchip0:

$ echo 0 > /sys/class/pwm/pwmchip0/export
$ echo 10000 > /sys/class/pwm/pwmchip0/pwm0/period
$ echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
$ echo normal > /sys/class/pwm/pwmchip0/pwm0/polarity
$ echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
  • How to confirm the PWM corresponding to pwmchip

$ find /sys/devices/ | grep pwmchip | grep uevent
/sys/devices/platform/fd8b0020.pwm/pwm/pwmchip1/uevent
/sys/devices/platform/fd8b0010.pwm/pwm/pwmchip0/uevent
/sys/devices/platform/fd8b0030.pwm/pwm/pwmchip2/uevent

fd8b0010.pwm is the corresponding node in the DTS.

ADC

The following uses SARADC_VIN3 as an example for illustration.

Read the ADC value

$ cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw

Example:

Read the voltage value of channel 3

#  cat /sys/bus/iio/devices/iio\:device0/in_voltage3_raw
3528

CAN

Applicable platforms: RK3568 / RK3576 / RK3588

Some RK chips support native CAN interfaces, which are usually led out to the expansion pins. The specific location can be found in the expansion pins section.

The native CAN interface of the chip cannot be used directly; an external level conversion circuit needs to be added.

Query the current network devices

$ ifconfig -a

CANFD Configuration

Turn off the CAN

$ ip link set can0 down

Set the bit rate to 500KHz

$ ip link set can0 type can bitrate 500000

Print the information of can0

$ ip -details -statistics link show can0

Turn on the CAN

$ ip link set can0 up

CAN FD Transmission

Transmit (standard frame, data frame, ID: 123, data: DEADBEEF):

$ cansend can0 123#DEADBEEF

Transmit (standard frame, remote frame, ID: 123)

$ cansend can0 123#R

CAN Reception

Turn on printing and wait for reception

$ candump can0

Loopback Mode Test

Method 1:

After turning on the CAN, enter the following command to start the loopback self-test (the base address is configured according to the actual CAN started in the DTS).

$ io -4 0xfea60000 0x8415

0xfea60000 is the DTS node of K8 CAN0.

In loopback mode, candump can receive data after cansend.

Example

  • Terminal 1

Start the loopback mode test and monitor the CAN

root@linaro-alip:/# io -4 0xfea60000 0x8415
root@linaro-alip:/# candump can0
  can0  123   [4]  DE AD BE EF
  • Terminal 2

Send the command

root@linaro-alip:/# cansend can0 123#DEADBEEF

Method 2:

Start the loopback test

$ ip link set can0 type can loopback on

Run candump in the background and turn on printing

$ candump can0 &

Send the command

$ cansend can0 123#DEADBEEF

SPI

Tool Location

$ kernel/tools/spi/spidev_test.c

Compilation

$ make CROSS_COMPILE=~/path-to-toolchain/gcc-xxxxx-toolchain/bin/xxxx-linux-gnu-

Select the CROSS_COMPILE used by the kernel.

Loopback Mode Test

$ spidev_test -D /dev/spidev0.0 -v -l -p "hello"

The main controller acts as the Master.

Short-circuit the MISO and MOSI pins.

  • Example

root@linaro-alip:/data# ./spidev_test -D /dev/spidev0.0 -v -l -p "hello"
spi mode: 0x24
bits per word: 8
max speed: 500000 Hz (500 kHz)
TX | 68 65 6C 6C 6F __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |hello|
RX | 68 65 6C 6C 6F __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |hello|
image-20240914152349051
image-20250312141333883
944056094ce6a949b748c927edbef52

First, confirm the location and number of the GPIO pins through the section. You can control the state of the specified GPIO by referring to the following steps.

The expansion pins of the mainboard are equipped with ADC. You can view the corresponding ADC position and channel number through the .

Expansion Pins
Expansion Pins section