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
  • Symbol Explanation
  • Expansion Pins
  • GPIO
  • CAN
  • PWM
  • UART
  • SPI
  • ADC
  1. K7(RK3576)
  2. en
  3. 02-Getting_Started_Guide

04-Expansion_Pins_Testing

Last updated 3 days ago

This document is used for users to quickly use or test the expansion pin functions of the motherboard.

Symbol Explanation

  • SDK$: Refers to the source code path.

  • console$: Generally refers to the command-line console of the motherboard.

  • ADB$: Android Debug Bridge command-line tool, generally refers to an environment where ADB can be run.

Expansion Pins

The development board is equipped with on-board expansion pin functions.

  • It can be used to connect external devices (such as temperature sensors, humidity sensors, etc.).

  • Communicate with other circuit boards or modules (I2C, SPI, UART, etc.).

  • Customize GPIO functions.

For specific function expansion details, refer to the pin list.

The pin list marks the default configuration of each pin (marked with an asterisk) and provides the available alternative configurations for that pin.

K7 Expansion Pin List

K7_PIN

K7 Pin Voltage

GPIO

The default GPIO pins (marked with an asterisk) of the expansion pins are configured as output ports, which can control the GPIO to output high or low levels.

List the registered GPIO control nodes

console$ ls /sys/class/leds/
GPIO0_A5  GPIO3_B0  GPIO3_D4  GPIO3_D5  PCIE_PWREN  SDMMC0_PWREN  fan  mmc2::  work

To control the level state of the GPIO below, $GPIO needs to correspond to the listed GPIO names.

Control the output level state of the GPIO

Control the GPIO to output a high level

console$ echo 1 >  /sys/class/leds/$GPIO/brightness

Control the GPIO to output a low level

console$ echo 0 >  /sys/class/leds/$GPIO/brightness

Example:

Control GPIO3_D4 to output a high level

console$ echo 1 >  /sys/class/leds/GPIO3_D4/brightness

Control GPIO3_D4 to output a low level

console$ echo 0 >  /sys/class/leds/GPIO3_D4/brightness

CAN

Query the current CAN device

The following uses CAN0 as an example for illustration.

console$ ifconfig -a
...
can0      Link encap:UNSPEC    Driver rk3576_canfd
          NOARP  MTU:16  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:10 
          RX bytes:0 TX bytes:0 
          Interrupt:63 
...

It can be seen that the device name is can0.

Configure CAN

Turn off CAN

console$ ip link set can0 down

Set the arbitration segment to a 1M baud rate and the data segment to a 3M baud rate

console$ ip link set can0 type can bitrate 1000000 dbitrate 3000000 fd on

View the configuration information of can0

console$ ip -details link show can0

Start CAN

console$ ip link set can0 up

CAN Transmission

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

console$ cansend can0 123#DEADBEEF

Transmit (extended frame, data frame, ID: 00000123, data: DEADBEEF)

console$ cansend can0 00000123##1DEADBEEF

CAN Reception

Enable printing and wait for reception

console$ candump can0

Loopback Mode Test

console$ ip link set can0 down
console$ ip link set can0 type can bitrate 500000 sample-point 0.8 dbitrate 2000000 sample-point 0.8 fd on loopback on
console$ ip -details -statistics link show can0
console$ ip link set can0 up
console$ echo 4096 > /sys/class/net/can0/tx_queue_len
console$ candump can0 &
console$ cansend can0 00000123##1DEADBEEF
  can0  00000123  [04]  DE AD BE EF

In loopback mode, the data sent by cansend can be received by candump.

PWM

List the PWM nodes

console$ ls /sys/class/pwm/
pwmchip0  pwmchip1  pwmchip2

List the corresponding PWM DTS nodes

console$ cat /sys/class/pwm/pwmchip*/device/uevent | grep FULLNAME
OF_FULLNAME=/pwm@27331000
OF_FULLNAME=/pwm@2ade6000
OF_FULLNAME=/pwm@2ade7000

The corresponding relationships are as follows, from top to bottom, corresponding to pwmchip0 to pwmchip2.

PWM0_CH1_M0 - pwm0_2ch_1 - pwm@27331000 - pwmchip0

PWM2_CH6_M2 - pwm2_8ch_6 - pwm@2ade6000 - pwmchip1

PWM2_CH7_M2 - pwm2_8ch_7 - pwm@2ade7000 - pwmchip2

Configure PWM

Example:

The software has already configured PWM0_CH1_M0 (marked with an asterisk) by default. The following uses PWM0_CH1_M0 for illustration.

Set the PWM0_CH1_M0 channel, corresponding to pwmchip0, with a period of 10000ns, a duty cycle of 5000ns, and a polarity of normal.

console$ echo 0 > /sys/class/pwm/pwmchip0/export
console$ echo 10000 > /sys/class/pwm/pwmchip0/pwm0/period
console$ echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
console$ echo normal > /sys/class/pwm/pwmchip0/pwm0/polarity
console$ echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

After successful configuration, you can use a multimeter to measure the PWM0_CH1_M0 pin, and the voltage should be around 1.6V.

UART

Loopback Test

The software has already configured UART8 by default. The following uses UART8 as an example for illustration.

Short-circuit RX and TX hardware.

Use microcom to specify UART8 for communication

console$ microcom -s 115200 /dev/ttyS8

Example:

root@linaro-alip:/# microcom -s 115200  -p /dev/ttyS8
[ 4218.137343] of_dma_request_slave_channel: dma-names property of node '/serial@2adb0000' missing or empty
connected to /dev/ttyS8
[ 4218.137431] dw-apb-uart 2adb0000.serial: failed to request DMA, use interrupt mode
Escape character: Ctrl-\
Type the escape character to get to the prompt.
hello uart word!

In the loopback test, microcom can receive the output characters simultaneously.

SPI

Loopback Test

The software has already configured SPI4 by default. The following uses SPI4 as an example for illustration.

Short-circuit MISO and MOSI hardware.

List the SPI device nodes

console$ ls /dev/spi*
/dev/spidev4.0

Specify the device for testing

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

Example:

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

The tool's network disk path

3-SoftwareData\Linux_Spi_Tool\spidev_test

ADC

Read the ADC value

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

Example:

Read the voltage value of channel 4

console$  cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw
3528
K7_PIN_DOMAIN

The expansion pins of the K7 motherboard can be configured as GPIO pins. Check the corresponding GPIO pin positions and numbers in the .

The expansion pins of the K7 motherboard can be configured as CAN interfaces. Check the corresponding CAN interface positions and numbers in the .

The expansion pins of the K7 motherboard can be configured as PWM interfaces. Check the corresponding PWM positions and channel numbers in the .

The expansion pins of the K7 motherboard can be configured as UART interfaces. Check the corresponding UART positions and channel numbers in the .

The expansion pins of the K7 motherboard can be configured as SPI interfaces. Check the corresponding SPI positions and channel numbers in the .

image-20250421165900688

The expansion pins of the K7 motherboard are equipped with three ADC channels. Check the corresponding ADC positions and channel numbers in the .

Expansion Pins section
Expansion Pins section
Expansion Pins section
Expansion Pins section
Expansion Pins section
Expansion Pins section
Motherboard command-line console