Manual Version
Disclaimer
While every effort has been made to ensure accuracy in this document, errors or omissions may still exist. Users should carefully assess its applicability; we reserve the right to make revisions at any time and do not guarantee the validity of content from previous versions. For the latest product information, please regularly visit the official website of LCSC Dev Boards for updated materials. The copyright and final interpretation of this document belong to Shenzhen JLC Technology Group Co.,Ltd. Please take note of this disclaimer and assess the risks independently when making decisions. We are not responsible for any issues arising from the use of this document. Thank you for your understanding and support.
Preparation
Before you begin, you need to do some preparatory work to ensure the smooth progress of the subsequent steps. I’ve listed them below:
- You will need a Windows 10 computer. Other operating systems may work theoretically, but I haven't tested them. For the purposes of this guide, I'll use my computer as an example, and unless otherwise specified, all environment setup and development compilation will assume this configuration.
- The computer must have ADB and serial debugging tools installed.
- LCSC Taishan-RK3566-Linux Dev Board must have the corresponding Android system firmware flashed.
- Logic analyzer and multimeter (optional, used for IO-related tasks).
Precautions
- Use the correct power adapter that meets the development board's specifications, ensuring the voltage and current match. For example, when powered via the USB of a computer, the current is limited. If devices like a display are connected, the insufficient current may cause boot issues.
- Always disconnect the power before plugging or unplugging connectors to avoid operating while powered.
- When handling LCSC Taishan-RK3566-Linux Dev Board or any circuit board without a case, try to hold the edges of the board to minimize the risk of electrostatic damage. It's important to develop good habits.
- Be careful when inserting or removing connectors. Ensure they are properly aligned, and insert or remove them gently to avoid damaging the connectors or development board interfaces. Specifically, the GH1.25 sockets with locks need to have the latch pressed before removal; avoid using forceful methods like pulling the wires.
- The MicroHDMI port and its corresponding adapter board are very fragile. Do not apply excessive force to avoid damaging the solder pads.
- The RK3566 chip will generate noticeable heat under high load conditions. Ensure good ventilation to avoid overheating. If necessary, use a heatsink or fan to lower the temperature.
- LCSC Taishan-RK3566-Linux Dev Board's packaging is a metal box. Although there is foam inside, it still poses a risk of conductivity. Do not power on the board while it is inside the box.
- Wishing you success in your development work! If you have any other questions, feel free to consult.
ADB Debugging Tool
《LCSC Taishan-RK3566-Linux Dev Board Resource\Chapter 03. Documentation Manuals\【Tools】ADB installation and usage.md》
Terminal Tools
《LCSC Taishan-RK3566-Linux Dev Board Resource\Chapter 03. Documentation Manuals\【Tools】Usage of debugging tools.md》
System Testing
Image Flashing
To flash the Buildroot system image, locate the image at:
Image Download
📌 Download Center(Click to Visit)
📌 Go to Download Center
->Baidu Netdisk Resource Content
->Chapter 06. System Images
->[Image] Android
->hdmi_20230915_update.img
For the flashing method, please refer to: Image Flashing Guide
Power-On Test
Power Supply Methods
LCSC Taishan-RK3566-Linux Dev Board has two power supply methods: via Type-C and external power jack. Note: Although there is a protection circuit, it is not recommended to use both Type-C (from the computer) and the external power jack simultaneously, as this could cause damage to the computer. Any resulting issues would be at your own risk.
Power Supply via Type-C
- Power Adapter: LCSC Taishan-RK3566-Linux Dev Board is usually powered through the Type-C interface. The recommended power supply should provide 5V and 2.5A to ensure the device runs properly.
- Computer Power Supply: The Type-C port on LCSC Taishan-RK3566-Linux Dev Board serves both as a power input and a USB interface. For example, code downloads and ADB debugging are done through this USB connection. However, the typical USB port on a computer provides only about 500mA, which can easily lead to insufficient power if too many resources are being used on the development board. If the system repeatedly fails to boot, you can try powering the board using an external power adapter. Note that if an EDP display needs to be powered, you should use the GH1.25 power jack and a small power board.
Power Supply via External Power Jack
- External Power Supply Connection: The external power supply is connected via a GH1.25 2P jack or 2.54 pin header. When connecting, make sure the positive and negative terminals are correctly aligned with the hardware. Do not reverse the polarity.
- Power Supply Adapter Requirements: Voltage: 12V, Current: 2A
- Note: The EDP screen backlight power is directly supplied from the GH1.25 jack. The backlight voltage for the provided EDP screen supports a range of 7V to 21V. Additionally, the external power circuit for LCSC Taishan-RK3566-Linux Dev Board converts to 5V, and supports an input voltage range of 5V to 18V. Considering this, we selected 12V for powering the board. If you use your own EDP screen, adjust the supply according to the manufacturer's power requirements, ensuring it falls within the 5V to 18V range and is compatible with the EDP voltage range.
Entering the System
If the hardware is functioning properly, the power indicator light on the development board will light up once powered. Following that, the working indicator light next to the USB port will start flashing with alternating colors.
The screen will display the Lichuang development board logo, and the development board will boot into the system normally.
Debugging Connection
There are two common debugging methods: serial port debugging and ADB debugging. Additionally, ADB can also be used for debugging over the network. Here, we will only cover the USB method. If you have not yet installed the serial debugging terminal and ADB, please refer to the following articles for installation.
Serial Terminal
- Before starting serial debugging, you need to prepare a USB to TTL tool, such as CH340.
- The debug port of the RK3566, UART2_RX_M0 and UART2_TX_M0, is connected through a GH1.25 4PIN jack and 2.54 header. For wiring, you only need to connect TX, RX, and GND. Note that the TX on LCSC Taishan-RK3566-Linux Dev Board connects to the RX of the tool, and the RX on LCSC Taishan-RK3566-Linux Dev Board connects to the TX of the tool.
- The debug serial port baud rate for LCSC Taishan-RK3566-Linux Dev Board is 1,500,000, with 8 data bits, 1 stop bit, and no parity bit.
- Once the connection is successful, press Enter repeatedly. Of course, you can also run Linux-related commands in this terminal.
ADB Debugging
In the ADB section, we discussed that although ADB is designed for Android development, it can also be used in Buildroot. Follow the steps below:
- Connect the Type-C cable to your computer and ensure that the LCSC Taishan-RK3566-Linux Dev Board successfully boots into the system.
- Confirm that the ADB device is recognized in Device Manager.
- Open Windows CMD, type adb shell, and you can begin your debugging operations.
DDR Check
root@RK356X:/# free -m #Display memory in MB
total used free shared buff/cache available
Mem: 1972 124 1728 33 119 1789
Swap: 0 0 0
2
3
4
You can also use the following command to get more detailed information:
root@RK356X:/# cat /proc/meminfo
MemTotal: 2019808 kB
MemFree: 1770200 kB
MemAvailable: 1833168 kB
Buffers: 4772 kB
Cached: 92788 kB
SwapCached: 0 kB
Active: 56656 kB
Inactive: 61372 kB
Active(anon): 45396 kB
Inactive(anon): 9860 kB
Active(file): 11260 kB
Inactive(file): 51512 kB
Unevictable: 24332 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 8 kB
Writeback: 0 kB
AnonPages: 44844 kB
Mapped: 76664 kB
Shmem: 34780 kB
KReclaimable: 25288 kB
Slab: 47024 kB
SReclaimable: 25288 kB
SUnreclaim: 21736 kB
KernelStack: 2400 kB
PageTables: 1028 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 1009904 kB
Committed_AS: 214660 kB
VmallocTotal: 263061440 kB
VmallocUsed: 5500 kB
VmallocChunk: 0 kB
Percpu: 512 kB
CmaTotal: 16384 kB
CmaAllocated: 2112 kB
CmaReleased: 14272 kB
CmaFree: 0 kB
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- For even more detailed memory information, you can use the following command, which is typically used for troubleshooting memory issues:
root@RK356X:/# dumpsys meminfo
- Check the DDR node:
root@RK356X:/# ls /sys/class/devfreq/dmc/
available_frequencies governor polling_interval trans_stat
available_governors load power uevent
cur_freq max_freq subsystem upthreshold
device min_freq system_status userspace
downdifferential name target_freq
2
3
4
5
6
- View the supported DDR frequencies:
root@RK356X:/# cat /sys/class/devfreq/dmc/available_frequencies
324000000 528000000 780000000 1056000000
2
- View the DDR scaling governors:
root@RK356X:/# cat /sys/class/devfreq/dmc/available_governors
dmc_ondemand userspace powersave performance simple_ondemand
# Governor Descriptions:
dmc_ondemand: Dynamically adjusts the frequency based on device load.
userspace: Allows users to set the frequency manually by changing the value in the /sys/class/devfreq/dmc/set_freq file.
powersave: Minimizes power consumption by reducing the frequency to conserve battery.
performance: Ensures maximum performance by running the device at the highest frequency.
simple_ondemand: A simplified version of dmc_ondemand that adjusts the frequency based on load, though at a slower rate.
2
3
4
5
6
7
8
9
10
11
12
13
- Check the current DDR frequency:
root@RK356X:/# cat /sys/class/devfreq/dmc/cur_freq
528000000
2
DDR Fixed Frequency
- Switch the governor to userspace mode:
root@RK356X:/# echo userspace > /sys/class/devfreq/dmc/governor
- Enter the desired frequency (must be one of the available frequencies):
root@RK356X:/# echo 1056000000 > /sys/class/devfreq/dmc/userspace/set_freq
- Verify if it has taken effect:
root@RK356X:/# cat /sys/class/devfreq/dmc/cur_freq
1056000000
root@RK356X:/# cat /sys/class/devfreq/dmc/load
220@1056000000Hz
2
3
4
5
CPU Check
- Check the CPU node:
root@RK356X:/# ls /sys/devices/system/cpu/cpufreq/policy0/
affected_cpus related_cpus scaling_governor
cpuinfo_cur_freq scaling_available_frequencies scaling_max_freq
cpuinfo_max_freq scaling_available_governors scaling_min_freq
cpuinfo_min_freq scaling_cur_freq scaling_setspeed
cpuinfo_transition_latency scaling_drive
- Check the supported frequencies of the CPU
root@RK356X:/# cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
408000 600000 816000 1104000 1416000 1608000 1800000
2
3
4
5
6
7
8
9
- View the available CPU frequencies:
root@RK356X:/# cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors
conservative ondemand userspace powersave interactive performance
# Governor Descriptions:
conservative: Dynamically adjusts frequency based on CPU load, balancing performance and power consumption with a slower response.
ondemand: Adjusts frequency dynamically with load; raises frequency during high demand and lowers it during low demand to conserve power.
userspace: Allows users to manually set the CPU frequency by modifying the value in the `/sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed` file.
powersave: Minimizes CPU power consumption by reducing frequency to the lowest possible level.
interactive: Quickly adjusts frequency based on load to ensure responsive performance and a smoother user experience.
performance: Maximizes performance by maintaining the CPU at the highest frequency.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Set the CPU governor to userspace:
root@RK356X:/# echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
- Set the CPU frequency (must be within scaling_available_frequencies):
root@RK356X:/# echo 1800000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
- To check the CPU frequency:
root@RK356X:/# cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
1800000 # Matches the set frequency, indicating successful application
1800000
1800000
1800000
2
3
4
5
- To check the CPU temperature: First, find the CPU temperature corresponding node, then use cat to check it:
root@RK356X:/ # cat /sys/class/thermal/thermal_zone0/type
soc-thermal #cpu temperature
root@RK356X:/ # cat /sys/class/thermal/thermal_zone1/type
gpu-thermal #gpu temperature
root@RK356X:/ # cat /sys/class/thermal/thermal_zone2/type
test_battery #battery temperature
2
3
4
5
6
To check the CPU temperature, the value here is in millidegrees Celsius. To convert it to Celsius, divide by 1000. For example, if the output is 41875, the temperature would be 41.875°C.
root@RK356X:/ # cat /sys/class/thermal/thermal_zone0/temp
41875
2
GPU Check
- Check the GPU node:
root@RK356X:/# ls /sys/class/devfreq/fde60000.gpu
available_frequencies device max_freq polling_interval target_freq
available_governors governor min_freq power trans_stat
cur_freq load name subsystem uevent
2
3
4
- View the available GPU frequencies:
root@RK356X:/# cat /sys/class/devfreq/fde60000.gpu/available_frequencies
800000000 700000000 600000000 400000000 300000000 200000000
2
- View the GPU operating governors:
root@RK356X:/# cat /sys/class/devfreq/fde60000.gpu/available_governors
dmc_ondemand userspace powersave performance simple_ondemand
# Governor Descriptions:
dmc_ondemand: Dynamically adjusts the frequency based on GPU load. It increases frequency when the demand is high and reduces it when the load is low, balancing performance and power consumption.
userspace: Allows users to manually set the GPU frequency. The frequency can be modified by changing the value in the `/sys/class/devfreq/fde60000.gpu/set_freq` file.
powersave: Aims to reduce GPU power consumption by lowering the frequency to the minimum to save power.
performance: Maximizes GPU performance by keeping the frequency at the highest level.
simple_ondemand: Similar to dmc_ondemand but with a simpler load-based adjustment to meet the GPU's performance needs.
2
3
4
5
6
7
8
9
10
11
12
13
- root@RK356X:/# echo userspace > /sys/class/devfreq/fde60000.gpu/governor
root@RK356X:/# echo userspace > /sys/class/devfreq/fde60000.gpu/governor
#check if succeed
root@RK356X:/# cat /sys/class/devfreq/fde60000.gpu/governor
userspace
2
3
4
- Set the GPU frequency (must be within available_frequencies):
root@RK356X:/# echo 800000000 > /sys/class/devfreq/fde60000.gpu/userspace/set_freq
- Check the current GPU frequency:
root@RK356X:/# cat /sys/class/devfreq/fde60000.gpu/cur_freq
800000000
2
- Check the GPU load:
root@RK356X:/# cat /sys/class/devfreq/fde60000.gpu/load
0@800000000Hz
2
- Check the GPU temperature: First, find the temperature node for the GPU and then check it:
root@RK356X:/ # cat /sys/class/thermal/thermal_zone0/type
soc-thermal # Corresponds to CPU temperature
root@RK356X:/ # cat /sys/class/thermal/thermal_zone1/type
gpu-thermal # Corresponds to GPU temperature
root@RK356X:/ # cat /sys/class/thermal/thermal_zone2/type
test_battery # Corresponds to battery temperature
2
3
4
5
6
To view the CPU temperature, the value is in millidegrees Celsius. To convert it to Celsius, divide by 1000. For example, if the value is 41875, it equals 41.875°C.
root@RK356X:/ # cat /sys/class/thermal/thermal_zone1/temp
41875
2
NPU Check
- Check the NPU node:
root@RK356X:/# ls /sys/class/devfreq/s /sys/class/devfreq/fde40000.npu
available_frequencies governor name target_freq
available_governors load polling_interval trans_stat
cur_freq max_freq power uevent
device min_freq subsystem userspace
2
3
4
5
- View the available NPU frequencies:
root@RK356X:/# cat /sys/class/devfreq/fde40000.npu/available_frequencies
200000000 297000000 400000000 600000000 700000000 800000000 900000000
2
- View the NPU operating governors:
root@RK356X:/# cat /sys/class/devfreq/fde40000.npu/available_governors
dmc_ondemand userspace powersave performance simple_ondemand
# Governor Descriptions:
dmc_ondemand: This governor dynamically adjusts the frequency based on the NPU device's load. It increases the frequency when the demand is high and decreases it when the load is low, balancing performance and power consumption.
userspace: This governor allows users to manually set the NPU device's frequency. Users can modify the frequency by changing the value in the `/sys/class/devfreq/fde60000.gpu/set_freq` file.
powersave: This governor aims to reduce the NPU device's power consumption by lowering the frequency to the minimum to save power.
performance: This governor maximizes performance by keeping the frequency at the highest level to achieve the best computational performance.
simple_ondemand: This governor is similar to the `dmc_ondemand` governor but is more simplified, offering basic load-based adjustments to meet the NPU device's performance needs.
2
3
4
5
6
7
8
9
10
11
12
13
- Set the GPU governor to userspace:
root@RK356X:/# echo userspace > /sys/class/devfreq/fde40000.npu/governor
# Check if the change was successful
root@RK356X:/# cat /sys/class/devfreq/fde60000.gpu/governor
userspace
2
3
4
- Set the GPU frequency (must be within available_frequencies):
root@RK356X:/# echo 900000000 > /sys/class/devfreq/fde40000.npu/userspace/set_freq
- View the current GPU frequency:
root@RK356X:/# cat /sys/class/devfreq/fde40000.npu/cur_freq
900000000
2
- View the GPU load:
root@RK356X:/# cat /sys/class/devfreq/fde40000.npu/load
100@900000000Hz
2
EMMC Check
Check storage space
root@RK356X:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 5.9G 219M 5.4G 4% /
devtmpfs 977M 0 977M 0% /dev
tmpfs 986M 0 986M 0% /dev/shm
tmpfs 986M 860K 985M 1% /tmp
tmpfs 986M 300K 985M 1% /run
/dev/mmcblk0p7 123M 13M 104M 11% /oem
/dev/mmcblk0p8 991M 25K 991M 1% /userdata
2
3
4
5
6
7
8
9
LED Indicators
- LCSC Taishan-RK3566-Linux Dev Board has an LED light located at the lower right corner. After powering up, it starts blinking to indicate that the system is running normally.
- The schematic shows the pin connections, which can be referenced in our open-source hardware project. Both the schematic and PCB are open-source.
- You can control these three LEDs using ADB commands. Let's first check the LED nodes, where rgb-led-b corresponds to the blue LED, rgb-led-g to the green LED, and rgb-led-r to the red LED.
root@RK356X:/# ls /sys/class/leds/
mmc0:: rgb-led-b rgb-led-g rgb-led-r
2
- Enter the rgb-led-x directory to view the related attributes. Here we use rgb-led-b as an example, but the others are the same.
root@RK356X:/# ls /sys/class/leds/rgb-led-b
brightness delay_on max_brightness subsystem uevent
delay_off device power trigger
2
3
brightness
: This attribute controls the LED's brightness. You can set the LED's brightness level by reading or writing to this file.device
: This attribute shows the device path associated with the LED.invert
: This attribute defines the LED's polarity. If the value is 0, the LED works as expected; if it’s 1, the LED’s behavior is reversed.max_brightness
: This attribute defines the maximum brightness value that the LED can accept. The brightness value is between 0 and max_brightness.power
: This attribute indicates the LED’s power status. It can be "on" to turn the LED on or "off" to turn it off.subsystem
: This attribute shows the subsystem to which the LED device belongs.trigger
: This attribute defines the trigger mechanism for the LED. It specifies the LED's behavior mode, such as blinking or breathing effects. You can change the LED's behavior by writing different trigger names. Here are some common triggers:none
: Disables the trigger, and the LED remains off.default-on
: Default trigger, keeping the LED on during boot.heartbeat
: Heartbeat trigger, with the LED blinking in a "heartbeat" pattern.timer
: Timer trigger, where the LED blinks at specific time intervals.
uevent
: This attribute contains event-related information for the LED device.You can also check supported trigger modes by using cat trigger.
root@RK356X:/# cat /sys/class/leds/rgb-led-b/trigger
none rfkill-any rfkill-none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altloc
k kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock mmc2 mmc0 [] rfkill0 mmc1 rfkill1 rfkill2
2
3
none
: Disables the trigger, and the LED stays off.rfkill-any
: Triggered by any RFKill state change, such as Wi-Fi or Bluetooth turning on or off.rfkill-none
: Triggered when RFKill is in a disabled state.test_ac-online
: Triggered when the power adapter is plugged in.test_battery-charging-or-full
: Triggered when the battery is charging or fully charged.test_battery-charging
: Triggered when the battery is charging.test_battery-full
: Triggered when the battery is fully charged.test_battery-charging-blink-full-solid
: The LED blinks while charging, then stays on when fully charged.test_usb-online
: Triggered when a USB device is inserted.mmc0
,mmc1
,mmc2
: Triggered when the corresponding MMC device is active.timer
: Triggered based on a set time interval.[]
: Heartbeat trigger, with a breathing effect on the LED.backlight
: Backlight trigger, commonly used to control the backlight of a display.default-on
: Default trigger that keeps the LED on during boot.rfkill0
,rfkill1
,rfkill2
: Triggered by changes in the state of the corresponding RFKill devices.To turn off all LEDs:
# Turn off the blue LED
rk3566_tspi:/ # echo "none" > /sys/class/leds/rgb-led-b/trigger
# Turn off the green LED
rk3566_tspi:/ # echo "none" > /sys/class/leds/rgb-led-g/trigger
# Turn off the red LED
rk3566_tspi:/ # echo "none" > /sys/class/leds/rgb-led-r/trigger
2
3
4
5
6
- To keep all LEDs on:
# Keep the blue LED on
rk3566_tspi:/ # echo "default-on" > /sys/class/leds/rgb-led-b/trigger
# Keep the green LED on
rk3566_tspi:/ # echo "default-on" > /sys/class/leds/rgb-led-g/trigger
# Keep the red LED on
rk3566_tspi:/ # echo "default-on" > /sys/class/leds/rgb-led-r/trigger
2
3
4
5
6
- Heartbeat effect:
# Heartbeat effect on the blue LED
rk3566_tspi:/ # echo "heartbeat" > /sys/class/leds/rgb-led-b/trigger
# Heartbeat effect on the green LED
rk3566_tspi:/ # echo "heartbeat" > /sys/class/leds/rgb-led-g/trigger
# Heartbeat effect on the red LED
rk3566_tspi:/ # echo "heartbeat" > /sys/class/leds/rgb-led-r/trigger
2
3
4
5
6
- Timer-based flashing:
# Timer flashing on the blue LED
rk3566_tspi:/ # echo "timer" > /sys/class/leds/rgb-led-b/trigger
# Timer flashing on the green LED
rk3566_tspi:/ # echo "timer" > /sys/class/leds/rgb-led-g/trigger
# Timer flashing on the red LED
rk3566_tspi:/ # echo "timer" > /sys/class/leds/rgb-led-r/trigger
2
3
4
5
6
Feel free to try different triggers yourself, like rfkill-any that lights up when you turn off Bluetooth, etc.
Buttons
- The development board includes three buttons, and the pin connections for these buttons can be checked in our open-source hardware project:
- PWR: Power button. Fullname TODO.
- RST: Reset button. Pressing this button resets the system hardware and restarts the development board. If you hold down the REC button and press RST, it will enter the Loader mode for flashing firmware.
- REC: Recovery button. Connected to SARADC_VIN0 with 10-bit resolution, this button enables entry into Loader flashing mode.
USB HOST
- LCSC Taishan-RK3566-Linux Dev Board features a USB 2.0 HOST interface, supporting USB hubs, mice, keyboards, flash drives, and other USB slave devices.
- This is the schematic of the pin connection. More details are available in our open-source hardware documentation.
- USB HOST Mouse Test
System Detected a New USB Mouse Device and Assigned Corresponding Event Input Device:
- Vendor ID (idVendor): 093a
- Product ID (idProduct): 2510
- Product Name (Product): USB Optical Mouse
- Manufacturer: PixArt The mouse device has been correctly identified and configured as an input device. It can be operated through the event input device file. The device file path is
/dev/input/event2
. This may vary depending on the system configuration and hardware. You can check if a new node has been created by running the commandls /dev/input/
, and then use the commandcat /dev/input/event2
to view the event data of the input device, monitoring mouse movements and button clicks, etc.Before and after inserting the device, you can see that a new node, event2, has been added.
root@RK356X:/# ls /dev/input/
by-path event0 event1 event3
root@RK356X:/# ls /dev/input/
by-id by-path event0 event1 event2 event3
2
3
4
Check if there is any data reporting. Since the data is unreadable, it appears as garbled text.
root@RK356X:/# cat /dev/input/event2
y�Y� ����
y�Y@
y�Y@
y�Y@����
y�Y@-
y�Y�p����
y�Y��
y�Y
2
3
4
5
6
7
8
9
WIFI & Bluetooth
- The Taishan-RK3566 development board is equipped with a WIFI + Bluetooth combo module, and the default module installed is the AP6212.
- AP6212 Module Overview:
- Link and datasheet: https://item.szlcsc.com/2941698.html
- 802.11b/g/n single-band radio
- Integrates Bluetooth V4.1 class 1.5 power amplifier with low energy (BLE) support
- Single antenna supports both BT/WLAN signal reception
- WLAN host interface option: SDIO v2.0—clock frequency up to 50 MHz
- BT host digital interface: UART (supports up to 4 Mbps)
- Built-in IEEE coexistence technology
- ECI — Enhanced Coexistence Interface, which coordinates BT SCO transmission to avoid WLAN reception conflicts
- For the development board hardware schematic, please refer to the open-source project. A detailed analysis will be provided in subsequent driver tutorials.
- The SDMMC1 interface corresponds to the WIFI function of the module
- The UART1 interface corresponds to the Bluetooth functionality of the module
- The I2S2 interface corresponds to Bluetooth audio functionality, such as connecting a Bluetooth headset to play music
WIFI Startup
Before using WIFI, ensure that the antenna is properly attached. If not, no WIFI networks will be detected. Attach the antenna gently by aligning it and pressing down carefully. Be gentle to avoid damaging the antenna socket.
- Check for the WIFI node using ifconfig, where the corresponding node is wlan0. If it doesn't appear, verify that the driver is functioning properly.
root@RK356X:/# ifconfig
eth0 Link encap:Ethernet HWaddr 26:72:9E:FE:24:65
UP BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:37
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1072 errors:0 dropped:0 overruns:0 frame:0
TX packets:1072 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:64768 (63.2 KiB) TX bytes:64768 (63.2 KiB)
wlan0 Link encap:Ethernet HWaddr 70:F7:54:CB:3E:31
inet addr:169.254.248.50 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::299e:7ced:b6d0:505f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:26392 (25.7 KiB)
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- Check if the wpa_supplicant process is running:
root@RK356X:/# ps -ef
- If not, start it manually. Before starting, configure the configuration file as follows:
root@RK356X:/# vi /data/cfg/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
update_config=1
network={
ssid="wucaicheng" # Wi-Fi Name
psk="1234567890" # Wi-Fi Password
key_mgmt=WPA-PSK # Encryption settings; set to key_mgmt=NONE for no encryption
}
2
3
4
5
6
7
8
9
10
11
- Start the wpa_supplicant process, which will communicate with it later through wpa_cli.
root@RK356X:/# wpa_supplicant -B -i wlan0 -c /data/cfg/wpa_supplicant.conf
Successfully initialized wpa_supplicant
2
- Check again:
root@RK356X:/# ps -ef
root 2006 1 0 13:59 ? 00:00:00 wpa_supplicant -B -i wlan0 -c /d
2
WIFI Scanning
The wpa_cli command communicates with the wpa_supplicant process, so ensure that wpa_supplicant is running. Scan for networks:
root@RK356X:/# wpa_cli -i wlan0 -p /var/run/wpa_supplicant scan
OK
2
Display scan results:
root@RK356X:/# wpa_cli -i wlan0 -p /var/run/wpa_supplicant scan_results
bssid / frequency / signal level / flags / ssid
94:14:57:0b:f0:9a 2437 -79 [][][] Jlc-STAFF
94:14:57:13:f0:9a 2437 -78 [][][] Jlc_Devices
94:14:57:03:f0:9a 2437 -77 [][][] jlc_office
94:14:57:23:f0:9a 2437 -80 [] Jlc-Visitor
94:14:57:2b:f0:9a 2437 -76 [] Jlc-Mobile device
42:bf:1d:03:71:48 2412 -45 [][] wucaicheng
root@RK356X:/#
2
3
4
5
6
7
8
9
- Bssid: The BSSID (Basic Service Set Identifier) of the wireless network.
- Frequency: The frequency (in MHz) of the network.
- Signal level: The signal strength (in dBm). Normally, -20 to -65 is strong; -65 to -70 is weak; below -70 to -90 is very weak. In such cases, check if the WIFI module is too far, whether the antenna is attached, or whether the RF parameters of the module are compliant.
- Flags: The security and feature flags of the wireless network. SSID: The SSID (network name) of the wireless network
wWi-Fi Connection
Method 1::
- Modify the configuration file:
root@RK356X:/# vi /data/cfg/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
update_config=1
network={
ssid="wucaicheng" # Wi-Fi name
psk="1234567890" # Wi-Fi password
key_mgmt=WPA-PSK # Encryption config; change to: key_mgmt=NONE for no encryption
}
2
3
4
5
6
7
8
9
10
11
- Reinitialize the wpa_supplicant process to read the above configuration:
root@RK356X:/# wpa_cli -i wlan0 -p /var/run/wpa_supplicant reconfigure
OK
2
- Start the connection:
root@RK356X:/# wpa_cli -i wlan0 -p /var/run/wpa_supplicant reconnect
OK
2
- Test the connection:
root@RK356X:/# ping lckfb.com
PING hzphdjjz7hjf3bsdzaa4uwdihfykpgam.yundunwaf4.com (47.113.24.127) 56(84) bytes of data.
64 bytes from 47.113.24.127 (47.113.24.127): icmp_seq=1 ttl=38 time=32.2 ms
64 bytes from 47.113.24.127 (47.113.24.127): icmp_seq=2 ttl=38 time=71.5 ms
64 bytes from 47.113.24.127 (47.113.24.127): icmp_seq=3 ttl=38 time=65.3 ms
64 bytes from 47.113.24.127 (47.113.24.127): icmp_seq=4 ttl=38 time=68.1 ms
64 bytes from 47.113.24.127 (47.113.24.127): icmp_seq=5 ttl=38 time=60.8 ms
^C
--- hzphdjjz7hjf3bsdzaa4uwdihfykpgam.yundunwaf4.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 32.222/59.591/71.536/14.131 ms
2
3
4
5
6
7
8
9
10
11
Method 2::
The latest SDK integrates the wifi_start.sh script, which can connect to Wi-Fi by simply providing the Wi-Fi name and password.
root@RK356X:/# wifi_start.sh wucaicheng 1234567890
connect to WiFi ssid: wucaicheng, Passwd: 1234567890
Successfully initialized wpa_supplicant
2
3
bt Start
root@RK356X:/# ./usr/bin/bt_pcba_test
killall: brcm_patchram_plus1: no process killed
###AMPAK FW Auto detection patch version = []###
Can't get device info: No such device
root@RK356X:/# cp: cannot stat '/data/cfg/device_info.txt': No such file or directory
FW folder path = /system/etc/firmware
proc_resetchip id = BCM43430A1
FW path = /system/etc/firmware/BCM43430A1.hcd
send hci_download_minidriverproc_resetDone setting line discpline
2
3
4
5
6
7
8
9
You can check common commands like up, down, etc., using -h.
root@RK356X:/# hciconfig -h
hciconfig - HCI device configuration utility
Usage:
hciconfig
hciconfig [] hciX []
Commands:
up Open and initialize HCI device
down Close HCI device
reset Reset HCI device
rstat Reset statistic counters
auth Enable Authentication
noauth Disable Authentication
encrypt Enable Encryption
noencrypt Disable Encryption
piscan Enable Page and Inquiry scan
noscan Disable scan
iscan Enable Inquiry scan
pscan Enable Page scan
ptype [] Get/Set default packet type
lm [] Get/Set default link mode
lp [] Get/Set default link policy
name [] Get/Set local name
class [] Get/Set class of device
voice [] Get/Set voice setting
iac [] Get/Set inquiry access code
inqtpl [] Get/Set inquiry transmit power level
inqmode [] Get/Set inquiry mode
inqdata [] Get/Set inquiry data
inqtype [] Get/Set inquiry scan type
inqparms [] Get/Set inquiry scan window and interval
pageparms [] Get/Set page scan window and interval
pageto [] Get/Set page timeout
afhmode [] Get/Set AFH mode
sspmode [] Get/Set Simple Pairing Mode
aclmtu <mtu:pkt> Set ACL MTU and number of packets
scomtu <mtu:pkt> Set SCO MTU and number of packets
delkey <bdaddr> Delete link key from the device
oobdata Get local OOB data
commands Display supported commands
features Display device features
version Display version information
revision Display revision information
block <bdaddr> Add a device to the blacklist
unblock <bdaddr> Remove a device from the blacklist
lerandaddr <bdaddr> Set LE Random Address
leadv [] Enable LE advertising
0 - Connectable undirected advertising (default)
3 - Non connectable undirected advertising
noleadv Disable LE advertising
lestates Display the supported LE states
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Activate the Bluetooth device:
root@RK356X:/# hciconfig hci0 up
View all Bluetooth devices in the current system:
root@RK356X:/# hciconfig -a
Normally, you should see something like this:
Scan for Bluetooth devices:
root@RK356X:/# hcitool scan
Scan results:
HDMI Screen
- LCSC Taishan-RK3566-Linux Dev Board comes with a Micro HDMI interface, which can be used to connect an HDMI display.
- For aesthetics and space efficiency, the Taishan-Pai uses a Micro HDMI interface. If your display uses a standard HDMI cable, you will need a Micro HDMI to HDMI adapter, or you can use a Micro HDMI cable instead.
- Reference for physical connection:
- To output video via HDMI, you need to download and use the HDMI output firmware. The firmware can be found in the following location: 《LCSC Taishan-RK3566-Linux Dev Board Resource\Chapter 06. System Images\【Image】Buildroot\hdmi_20230915_update.img》
- Once the firmware and connection are correct, the development board will be able to display images via HDMI after power-up.
- To check the HDMI status via adb, use the following command. If "Connector: HDMI-A-1" is displayed, it indicates that HDMI is functioning normally. If cat does not detect HDMI, it may indicate that the HDMI peripheral is not connected properly. The issue could be with the driver, screen connection, or incorrect firmware burning.
root@RK356X:/# cat /sys/kernel/debug/dri/0/summary
Video Port0: ACTIVE
Connector: HDMI-A-1
bus_format[]: RGB888_1X24
overlay_mode[] output_mode[] color_space[]
Display mode: 1920x1080p60
clk[] real_clk[] type[] flag[]
H: 1920 2008 2052 2200
V: 1080 1084 1089 1125
Smart0-win0: ACTIVE
win_id: 0
format: XR24 little-endian (0x34325258) SDR[] color_space[] glb_alpha[]
rotate: xmirror: 0 ymirror: 0 rotate_90: 0 rotate_270: 0
csc: y2r[] r2y[] csc mode[]
zpos: 0
src: pos[] rect[]
dst: pos[] rect[]
buf[]: addr: 0x00000000007f1000 pitch: 7680 offset: 0
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
EDP Screen
The LCSC Taishan-RK3566-Linux Dev Board has an onboard EDP interface located at the top of the board. It connects via a 30-pin 0.5mm pitch FPC cable and can be used to connect an EDP display. Most modern laptops use this type of interface.
Hardware Connection:
- The following diagram shows the pinout definition for the EDP screen (refer to the open-source project for more details). This 30-pin pinout is relatively common in the industry. Once you understand the Taishan-RK3566 development (screen adjustment), you can directly purchase a screen of your choice on platforms like Taobao or Xianyu to light it up. Alternatively, you can contact us for debugging. In the early stages, it’s recommended to test using screens that have been validated by us.
- In the schematic, pins 26, 27, 28, and 29 are the backlight pins, connected to VCC12V_DCIN. Therefore, to power the EDP screen, an additional power supply is required. Note that the backlight power for our EDP screen comes directly from the GH1.25 connector, and the backlight voltage supported by the EDP screen ranges from 7V to 21V. Additionally, the Taishan-RK3566 board's external 5V power circuit supports 5V-18V input. Based on these considerations, we selected 12V for power supply. If you're using an EDP screen purchased elsewhere, adjust according to the manufacturer's power supply requirements to avoid damaging the screen.
- For physical connection, we use our provided screen as an example. For other screens, please determine the cable sequence yourself. First, open the FPC with the gold contacts facing downward (since our FPC is a bottom connection). Insert the cable until you feel it firmly in place, then secure the FPC cover, as shown in the image below.
15.6-inch 1920x1080 Screen
- Screen purchase link: Please note that this screen is purchased for testing purposes only. We do not provide after-sales support for this screen.
- Before testing the screen, you need to flash the 15.6-inch screen firmware. The firmware can be found here:
Firmware Download
📌 Download Center(Click to Visit)
📌 Go to Download Center
->Baidu Netdisk Resource Content
->Chapter 06. System Images
->[Image]Buildroot
->edp1366X768_20230912_update.img
- After connecting the screen, the screen can be lit normally with 12V external power supply, as shown below.
- Viewing edp screen status using adb
root@RK356X:/# cat /sys/kernel/debug/dri/0/summary
Video Port0: ACTIVE
Connector: eDP-1
bus_format[]: RGB888_1X24
overlay_mode[] output_mode[] color_space[]
Display mode: 1366x768p61
clk[] real_clk[] type[] flag[]
H: 1366 1516 1521 1526
V: 768 771 772 781
Smart0-win0: ACTIVE
win_id: 0
format: XR24 little-endian (0x34325258) SDR[] color_space[] glb_alpha[]
rotate: xmirror: 0 ymirror: 0 rotate_90: 0 rotate_270: 0
csc: y2r[] r2y[] csc mode[]
zpos: 0
src: pos[] rect[]
dst: pos[] rect[]
buf[]: addr: 0x0000000000811000 pitch: 5504 offset:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
- Use ADB command to set backlight echo “0-255” > /sys/class/backlight/backlight/brightness
root@RK356X:/# echo "16" > /sys/class/backlight/backlight/brightness
MIPI Screen
The Taishan-RK3566 development board is equipped with a MIPI DSI display interface located at the back of the board. It is connected via a 31-pin 0.3mm pitch FPC interface, allowing you to connect a MIPI display. This interface is commonly used in most smartphones and tablets.
Hardware Connection:
- The following diagram shows the pin definition for our MIPI screen (for detailed information, refer to the open-source project). This 31-pin pinout is quite common in the industry, which means once you master the Taishan development board (screen adjustment), you can directly buy your preferred screen from platforms like Taobao or Xianyu based on this pinout and light it up. Of course, you can also contact us for debugging, and for initial testing, you can base your work on the screen we have verified.
- For physical connection, we will use the screen provided by us as an example. For other screens, you will need to determine the pinout yourself. First, open the FPC and ensure the golden fingers of the flex cable are facing down (as our FPC connects from the bottom). Then, insert the FPC carefully, ensuring you feel a clear stop, and lock the FPC cover as shown in the image below.
8-inch 800x1280 Screen
- Screen purchase link:Click here
Please note that this screen is purchased for testing purposes only. We do not provide after-sales support for this screen.
- Before testing the screen, you need to burn the 8-inch screen firmware. The firmware location:
Chapter 06. System Images\ [Image] Buildroot\mipi_800x1280_20230912_update.img
- After connecting the screen, power on the board to light up the screen, as shown below. Note: If the power supply is insufficient, the system may fail to boot properly, resulting in a screen flickering loop.
- Using adb to view mipi screen status
root@RK356X:/# cat /sys/kernel/debug/dri/0/summary
Video Port1: ACTIVE
Connector: DSI-1
bus_format[]: RGB888_1X24
overlay_mode[] output_mode[] color_space[]
Display mode: 800x1280p59
clk[] real_clk[] type[] flag[]
H: 800 818 830 848
V: 1280 1304 1308 1320
Cluster0-win0: ACTIVE
win_id: 4
format: AB24 little-endian (0x34324241)[] SDR[] color_space[] glb_alpha[]
rotate: xmirror: 0 ymirror: 0 rotate_90: 0 rotate_270: 0
csc: y2r[] r2y[] csc mode[]
zpos: 0
src: pos[] rect[]
dst: pos[] rect[]
buf[]: addr: 0x00000000003e8000 pitch: 3200 offset: 0
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
- Use the ADB command to set the backlight echo “0-255” > /sys/class/backlight/backlight/brightness
root@RK356X:/ # echo "16" > /sys/class/backlight/backlight/brightness
Audio Interface
The Taishan development board provides microphone and speaker interfaces through a 4-pin GH1.25 header and 2.54 pads, as shown below: the front side has the GH1.25 header, and the back side has the 2.54 pads.
Hardware Connection:
- The following diagram shows the hardware connection schematic for the audio section (for more details, refer to the open-source project). It is mainly implemented by the RK809 chip. The RK809 integrates the functions for both speakers and headphones with an I2S interface. The speaker uses a high-efficiency stereo Class-D amplifier, which can output 1.3W of power to an 8-ohm BTL load from a 5V power supply. It also includes overcurrent protection. In simpler terms, this means it delivers low power for basic sound, but for high-quality audio, you'll need to use an expansion board with a better amplifier.
- The schematic of the 4-pin GH1.25 header is as follows:Pin 1 (MIC1P) is connected to the positive terminal of the microphone. Pin 2 is connected to the ground of the microphone. Pins 3 and 4 are connected to the speaker.
- To make debugging easier, we also provide 2.54mm spaced pads. The schematic is defined as follows, corresponding to the pads on the backside of the board shown above.
Audio Expansion Module Usage
- Pre-debugging Considerations:
- you need to flash the
buildroot
/ubuntu
/debian
system firmware.
- you need to flash the
System Firmware Download
📌 Download Center(Click to Visit)
📌 Go to Download Center
->Baidu Netdisk Resource Content
->Chapter 06. System Images
If the GH1.25 external audio interface does not work when using the HDMI screen firmware, please disconnect the HDMI for testing. This is because the original system audio output scheme is set to output audio through HDMI after plugging in the HDMI cable, bypassing the external amplifier. We have modified the system to output audio to both HDMI and the external amplifier simultaneously.
If you have connected our multimedia expansion board, make sure that the headphone jack is not inserted. You can check this by looking for the headphone icon in the top right corner of the system. If the headphone is plugged in, the audio output will not use the external amplifier route.
The connection diagram between the development board and the expansion board is shown below:
Audio Recording Test
#Recording command, press ctrl+C to stop:
root@RK356X:/# arecord -c 1 -r 44100 -f S16_LE /tmp/record.wav
Recording WAVE '/tmp/record.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
^CAborted by signal Interrupt...
#The arecord command is used for recording audio and saving it as a file named record.wav. Below is an explanation of each option in the command:
#-c 1: Record in mono (single channel).
#-r 44100: This represents the sample rate, which is the number of audio samples per second. A sample rate of 44100 means 44100 samples per second, which is the standard sample rate for CD-quality audio.
#-f S16_LE: This specifies the audio sample format. S16_LE means the samples are stored in a 16-bit signed little-endian format.
#/tmp/record.wav: This is the path and name of the file where the audio recording will be saved.
2
3
4
5
6
7
8
9
Speaker Playback Test
# Play the audio that was just recorded. Press ctrl+C to stop playback or wait for it to finish.
root@RK356X:/# aplay /tmp/record.wav
2
Dual Screen Display
HDMI and EDP Simultaneous Display
HDMI and MIPI Simultaneous Display
EDP and MIPI Simultaneous Display
Camera
The Taishan-RK3566 development board has an onboard MIPI CSI camera interface, which can be used to drive MIPI-compatible cameras. It is located on the back of the development board, as shown in the image below:
Hardware Connection
- The following diagram illustrates the hardware connection for the MIPI CSI section (see the open-source project for more details). The necessary power supply circuit has been integrated into the development board, and the 30-pin connector on the board supports the pinout used by most manufacturers. You can directly purchase cameras with the same pinout from platforms like Taobao for compatibility, without needing an expansion board.
- Physical Connection Diagram
- The following example shows the camera we tested. If you want to use another camera, make sure to check the cable pinout and adapt the driver code accordingly. You can also contact us for debugging assistance.
OV5695 Test
Note: This camera model was purchased for testing, and we do not offer after-sales support for the camera itself.
- Basic Parameters:
- Model: OV5695
- Resolution: 5000,000
- Interface: MIPI 30P 0.5mm pitch FPC
Testing
Capture video and display it on the screen. Note that to ensure correct display, do not use the dual-screen firmware. Use the single MIPI or single eDP firmware for testing.
root@RK356X:/# gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! kmssink
Setting pipeline to PAUSED ...
Using mplane plugin for capture
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
0:01:34.3 / 99:99:99.
2
3
4
5
6
7
8
9
10
Parameter breakdown:
v4l2src
element is used to capture video data from the video device/dev/video0
video/x-raw
specifies the raw format of the video data. Here,NV12
is used, which is a common YUV format.width=1920
andheight=1080
set the video resolution to 1920x1080 pixels.framerate=30/1
sets the frame rate to 30 frames per second.kmssink
element is used to display the video on a DRM device. Below is the effect of capturing video from the camera and displaying it on the eDP screen:
MicroSD Card
The Taishan-RK3566 development board has an onboard MicroSD (TF) card slot located on the back of the board, which can be used for file storage or system image creation. Below, we primarily focus on the file storage function, as our system defaults to downloading files to the EMMC. For instructions on using the TF card for system boot, please refer to the flashing documentation.
Hardware Connection
The following diagram illustrates the hardware connection for the MicroSD section (refer to the open-source project for more details).
Usage Method
- Insert the MicroSD card with the metal connectors facing down (toward the PCB side) into the slot. Ensure the card aligns properly with the slot during insertion.
- Gently press the MicroSD card until it is fully inserted into the slot.
- After insertion, the card slot will lock in place, and you will hear a click indicating the card is securely in place.
- Once inserted, the system will display the TF card icon as shown below:
- Check the available storage capacity of the SD card and navigate to the SD card folder. (If the card has been formatted, you will see various Android-related folders.)
Testing
- When the TF card is inserted, we can check the device name of the inserted TF card in the terminal using the following command:
root@RK356X:/# dmesg | grep mmc
[] mmc_host mmc1: Bus speed (slot 0) = 375000Hz (slot req 400000Hz, actual 375000HZ div = 0)
[] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[] mmc1: new high speed SDHC card at address 59b4
[] mmcblk1: mmc1:59b4 SMI 948 MiB
[] mmcblk1: p1
2
3
4
5
6
This indicates that the TF card is recognized as /dev/mmcblk1.
- Create a directory to mount the TF card:
root@RK356X:/# mkdir /media/sdcard
- Use the following command to mount the TF card to the specified directory:
root@RK356X:/# mount /dev/mmcblk1p1 /media/sdcard
Note: If your TF card has multiple partitions, you can use different partition numbers (such as /dev/mmcblk1p2, /dev/mmcblk1p3, etc.) to mount them.
- Now, you can access and operate on the mounted TF card through the /media/sdcard path. For example, I created a directory named www.lckfb.com:
root@RK356X:/media/sdcard# mkdir www.lckfb.com
root@RK356X:/media/sdcard# ls
www.lckfb.com
root@RK356X:/media/sdcard#
2
3
4
- Write test:
root@RK356X:/media/sdcard# dd if=/dev/zero of=/media/sdcard/testtf.txt bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.481621 s, 218 MB/s
root@RK356X:/media/sdcard# ls
testtf.txt www.lckfb.com
2
3
4
5
6
- Clear the cache:
root@RK356X:/media/sdcard# echo 3 > /proc/sys/vm/drop_caches
- Read test:
root@RK356X:/# dd if=/media/sdcard/testtf.txt of=/dev/null bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.142593 s, 735 MB/s
2
3
4
- Unmount:
root@RK356X:/# umount /media/sdcard
4G Module
- Most 4G modules use a mini PCIe interface, but they are actually connected via USB. Therefore, we only need a mini PCIe to USB adapter board, which can then be plugged into the USB port on the Taishan-RK3566 development board to enable 4G internet access. If you feel that connecting via USB is not the most elegant solution, we will later discuss how to use a 4G module on an expansion board for internet functionality.
- mipiPCIE Purchase Link: (Note: We are not responsible for any after-sales issues related to the purchase, as it was simply tested and verified by us.)
- Below is an image showing how to insert the 4G module and SIM card. Note that the 4G module may require antennas depending on the actual model. For example, some modules with GPS functionality may need two antennas. Ensure the antennas are connected correctly to the matching ports.
Hardware Connection
- Since the Taishan-RK3566 only has one USB port, you will need to add a USB hub or use our Taishan multimedia expansion board to connect the 4G module, USB-to-4G adapter, and other peripherals like a mouse or light.
EC20
- Purchase Link:Click here🚀 (Note: We are not responsible for any after-sales issues related to the purchase, as it was simply tested and verified by us.)
RTC
The Taishan development board has the RTC module integrated into the RK809 chip, which is exposed on the back through a 2.54mm pitch header.
Hardware Connection
To test the RTC, you will need a coin cell battery and ensure that the battery has sufficient charge (around 3V when measured with a multimeter). Due to limited space on LCSC Taishan-RK3566-Linux Dev Board and for aesthetic purposes, we have opted not to include a coin cell holder. If you wish to use the RTC, you will need to solder the black wire of the battery to the GND pad and the red wire to the RTC pad using a soldering iron.
Battery purchase link:https://item.szlcsc.com/5782992.html
RTC Testing
In the buildroot system, there are two types of clocks: one is the System time (buildroot system clock) and the other is the hardware clock (RTC clock).
- Set the system time:
root@RK356X:/# date -s "2023-09-022 22:22:33"
Fri Sep 22 22:22:33 UTC 2023
2
- View the current buildroot system time:
root@RK356X:/# date
Fri Sep 22 22:23:06 UTC 2023
2
- View the hardware time of the rk809 RTC. You will notice that the system time and hardware time are different:
root@RK356X:/# hwclock -f /dev/rtc0
Fri Aug 4 12:43:03 2017 0.000000 seconds
2
- Write the system time to the rk809 RTC:
root@RK356X:/# hwclock -f /dev/rtc0 -w
- After writing, check the rk809 RTC hardware time, which now matches the system time:
root@RK356X:/# hwclock -f /dev/rtc0
Fri Sep 22 22:24:51 2023 0.000000 seconds
2
40PIN Header Interface
The Taishan development board is equipped with a 40PIN 2.54mm pitch header, with pin definitions compatible with the classic 40PIN interface as shown below:
Pin Definitions
- Taishan development board 40PIN schematic (for detailed information, refer to the open-source project🚀
- The 40PIN pin default function definition diagram for the Taishan board. This definition order is designed to be compatible with the Raspberry Pi, and the 40PIN GPIO driver in the default firmware is also allocated according to this diagram:
- To support more functionalities and better meet the needs of various projects, in addition to the aforementioned compatibility with the Raspberry Pi pin multiplexing definitions, the Taishan board 40PIN pins also support additional multiplexing functions, such as UART, PWM, audio, etc. However, drivers need to be written for these functions, or you can contact us for adaptation.
Default Interface Definition Testing
Next, we will conduct a functional test of the 40PIN GPIO based on the default IO definition. Before starting, you need to flash the buildroot/ubuntu/debian system firmware:
System Firmware Download
📌 Download Center(Click to Visit)
📌 Go to Download Center
->Baidu Netdisk Resource Content
->Chapter 06. System Images
GPIO Testing
The Taishan development board’s 40PIN header has 28 IO pins, in addition to 12 power pins. These 28 IO pins can be used as general GPIO for input and output. However, some IO pins are already configured with multiplexing functions in the driver, so only the 14 IO pins marked in red are available for GPIO output/input testing.
Hardware Connection
Here, we take GPIO0_B7 as an example, and other IOs are similar.
- Use a logic analyzer or multimeter to check the high and low voltage output of the GPIO pin. This content can only be displayed in Lark documents.
- Use two DuPont wires in series with a 10K resistor, one end connected to GPIO0_B7, and the other end to GND or 3.3V to simulate high and low voltage inputs (Note: The resistor should not be omitted, and do not connect it to 5V to avoid damaging the GPIO pin). This content can only be displayed in Lark documents.
GPIO Naming Rules and Pin ID Calculation
Next, we will use sysfs in adb to control GPIO0_B7 for input and output testing. Before using sysfs, we need to understand the GPIO naming rules for the RK3566, as pin IDs are required in sysfs parameters. Let's take the GPIO0_B7 example and break it down into three parts as follows:
- Bank: The RK3566 has 5 GPIO controllers, namely GPIO0 to GPIO4. Each controller contains multiple ports (A, B, C, D), and each port has 0-7 index numbers, so a controller can control 32 IO pins.
- Port: A, B, C, D correspond to numbers 0-3, so A=0, B=1, C=2, D=3. Fixed at 0-7, a total of 8 numbers. By applying this to GPIO0_B7, the pin ID can be calculated as follows:
- The bank is 0, which refers to the 0th group of controllers.
- The port is B, which indicates port number 1. The pin is 7. Using the formula: 32 x 0 + 1 x 8 + 7 = 15, we get the pin ID of 15.
GPIO Output Test
# Use root privileges
rk3566_tspi:/ # su
# Export pin number 15 as a GPIO pin so it can be accessed and controlled.
rk3566_tspi:/ # echo 15 > /sys/class/gpio/export
# Set the direction of pin number 15 to output mode, making it an output pin.
rk3566_tspi:/ # echo out > /sys/class/gpio/gpio15/direction
# Set the value of pin number 15 to 1, which sets the pin to high level.
rk3566_tspi:/ # echo 1 > /sys/class/gpio/gpio15/value
# Set the value of pin number 15 to 0, which sets the pin to low level.
rk3566_tspi:/ # echo 0 > /sys/class/gpio/gpio15/value
# Unexport pin number 15, cancelling GPIO control over pin number 15.
rk3566_tspi:/ # echo 15 > /sys/class/gpio/unexport
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
The following demonstrates how to use sysfs to control GPIO0_B7 to output high and low voltage levels, with the voltage changes captured by a logic analyzer.
GPIO Input Test
# Use root privileges
rk3566_tspi:/ # su
# Export pin 15 as a GPIO pin so it can be accessed and controlled.
rk3566_tspi:/ # echo 15 > /sys/class/gpio/export
# Set pin 15 direction to input mode, i.e., set it as an input pin.
rk3566_tspi:/ # echo in > /sys/class/gpio/gpio15/direction
# Read the pin's value, the result will be 1 or 0, depending on the actual level of the pin.
rk3566_tspi:/ # cat /sys/class/gpio/gpio15/value
# Unexport pin 15, i.e., cancel GPIO control over pin 15.
rk3566_tspi:/ # echo 15> /sys/class/gpio/unexport
2
3
4
5
6
7
8
9
10
11
12
13
14
The following demonstrates how to use sysfs to control GPIO0_B7 for high and low level input detection.
Note:
If the IO pin is multiplexed in the device driver, the export operation will fail, and gpiox will not be found.
Serial Port Test
Many IO pins in the user GPIO can be multiplexed to serial port functions (refer to the multiplexing definition table). However, here we perform a multiplex test only for pins 8 and 9, based on the default configuration. The pin definitions are shown in the figure below:
Hardware Connection
To test the serial port, we need a serial debugging tool. Here, we use the most commonly used CH340 as an example. From the pin definitions above, we can see that GPIO pins 8 and 9 correspond to UART3. We will use DuPont wires to connect UART3_TX_M1 to the RXD pin of the CH340, UART3_RX_M1 to the TXD pin of the CH340, and also ground them together. The connection diagram is as follows:
After inserting the CH340 into the computer, a serial device will appear in the Device Manager.
Open the serial debugging tool electerm, set the port to COM34, the baud rate to 9600, and keep other settings default.
In ADB, locate the corresponding serial port node. Here, the UART3 corresponds to ttyS3.
rk3566_tspi:/ # ls /dev/
__properties__ fscklogs kmsg rga usb-ffs
ashmem full kmsg_debug rtc0 usb_accessory
ashmeme02e9dfb-e7c9-4b5a-93ea-453a4d62e115 fuse loop-control snd v4l-subdev0
binder gpiochip0 mali0 socket v4l-subdev1
binderfs gpiochip1 media0 spi_misc_test v4l-subdev2
blkio gpiochip2 memcg stderr vendor_storage
block gpiochip3 memory_bandwidth stdin video0
boringssl gpiochip4 mmcblk2rpmb stdout video1
bus gpiochip5 mpp_service stune video2
cgroup_info graphics net sw_sync video3
console hw_random network_latency tee0 video4
cpu_dma_latency hwbinder network_throughput teepriv0 video5
cpu_variant:arm i2c-0 null tty video6
cpu_variant:arm64 i2c-2 opteearmtz00 ttyFIQ0 video7
cpuctl i2c-3 pmsg0 ttyS1 video8
cpuset i2c-4 ppp ttyS3 vndbinder
device-mapper i2c-6 ptmx tun watchdog
dri iio:device0 pts uhid watchdog0
event-log-tags input random uinput zero
fd ion rfkill urandom
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Before starting the test, you need to set the serial parameters for ttyS3. These settings must match those in the serial communication tool to avoid issues such as garbled text or failure to display.
stty -F /dev/ttyS3 <波特率> cs<数据位> <奇偶校验> <停止位> <流控制>
<baud rate> common values include 9600, 115200, etc.
<data bits> refers to the number of data bits, common values are 5, 6, 7, 8, with 8 being the default.
<parity> specifies the parity type, possible values are -parity (no parity), even (even parity), and odd (odd parity).
<stop bits> refers to the number of stop bits, common values are cstopb=1、-cstopb=2, with the default being cstopb.
<flow control>crtscts:enable RTS/CTS hardware flow control.-crtscts:disable RTS/CTS hardware flow control.
2
3
4
5
6
Set the serial parameters for ttyS3, keeping all other settings default, and just set the baud rate.
rk3566_tspi:/ # stty -F /dev/ttyS3 9600
Send a data test by transmitting "lckfb-tspi" to ttyS3:
rk3566_tspi:/ # echo "lckfb-tspi" > /dev/ttyS3
The terminal will correctly display the content we just sent.
For receiving data, use cat on ttyS3 to wait for data:
rk3566_tspi:/ # cat /dev/ttyS3
In the serial console, enter any characters, such as "abcdefg1234567", and press Enter to send.
At this point, the development board has correctly received the data just sent.
Demonstration:
Infrared Remote Control Test
The GPIO pin 32 can be used to receive signals from an infrared remote control, as shown in the diagram below:
For this experiment, we need an infrared remote control and an infrared receiver module. You can purchase the infrared remote control from , but please note that we are only testing it and will not provide after-sales or technical support.
The infrared receiver module IRM-56384 can be purchased here:https://item.szlcsc.com/73157.html
Hardware Connection
Use jumper wires to connect the IRM-56384 infrared receiver to the user GPIO. The connection diagram is shown below, please make sure the connections are correct and not reversed or wrong:
Testing
The button descriptions for the infrared remote control are shown below. Note that these button values are not fixed, and in the later driver tutorial, we will learn how to modify the button values.
During the remote control test, remember that the remote must be pointed at the raised side of the infrared receiver. Then go to adb, of course you can also debug through the serial port.
C:\Users\jlc>adb shell
Use evtest to view events. The corresponding event for our receiver header is fe700030.pwm
event0, so we select Select the device event number []: 0
.
root@RK356X:/# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: fe700030.pwm
/dev/input/event1: rk805 pwrkey
/dev/input/event2: adc-keys
/dev/input/event3: SEM USB Keyboard
/dev/input/event4: SEM USB Keyboard Consumer Control
/dev/input/event5: SEM USB Keyboard System Control
/dev/input/event6: USB OPTICAL MOUSE
Select the device event number []: 0
2
3
4
5
6
7
8
9
10
11
After selecting, press Enter to start testing the "fe700030.pwm" input device. The supported events will be displayed, and it will wait for input. At this point, you can trigger the corresponding event reports by pressing buttons on the remote control. Below: I pressed buttons 1-9 and all other keys.
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x524b product 0x6 version 0x100
Input device name: "fe700030.pwm"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 2 (KEY_1)
Event code 3 (KEY_2)
Event code 4 (KEY_3)
Event code 5 (KEY_4)
Event code 6 (KEY_5)
Event code 7 (KEY_6)
Event code 8 (KEY_7)
Event code 9 (KEY_8)
Event code 10 (KEY_9)
Event code 11 (KEY_0)
Event code 28 (KEY_ENTER)
Event code 103 (KEY_UP)
Event code 105 (KEY_LEFT)
Event code 106 (KEY_RIGHT)
Event code 108 (KEY_DOWN)
Event code 139 (KEY_MENU)
Event code 143 (KEY_WAKEUP)
Event code 158 (KEY_BACK)
Properties:
Testing ... (interrupt to exit)
Event: time 1501837310.364775, type 1 (EV_KEY), code 2 (KEY_1), value 1
Event: time 1501837310.364775, -------------- SYN_REPORT ------------
Event: time 1501837310.452543, type 1 (EV_KEY), code 2 (KEY_1), value 0
Event: time 1501837310.452543, -------------- SYN_REPORT ------------
Event: time 1501837311.467120, type 1 (EV_KEY), code 3 (KEY_2), value 1
Event: time 1501837311.467120, -------------- SYN_REPORT ------------
Event: time 1501837311.555874, type 1 (EV_KEY), code 3 (KEY_2), value 0
Event: time 1501837311.555874, -------------- SYN_REPORT ------------
Event: time 1501837312.385465, type 1 (EV_KEY), code 4 (KEY_3), value 1
Event: time 1501837312.385465, -------------- SYN_REPORT ------------
Event: time 1501837312.472543, type 1 (EV_KEY), code 4 (KEY_3), value 0
Event: time 1501837312.472543, -------------- SYN_REPORT ------------
Event: time 1501837313.361106, type 1 (EV_KEY), code 5 (KEY_4), value 1
Event: time 1501837313.361106, -------------- SYN_REPORT ------------
Event: time 1501837313.449207, type 1 (EV_KEY), code 5 (KEY_4), value 0
Event: time 1501837313.449207, -------------- SYN_REPORT ------------
Event: time 1501837314.189838, type 1 (EV_KEY), code 6 (KEY_5), value 1
Event: time 1501837314.189838, -------------- SYN_REPORT ------------
Event: time 1501837314.279211, type 1 (EV_KEY), code 6 (KEY_5), value 0
Event: time 1501837314.279211, -------------- SYN_REPORT ------------
Event: time 1501837315.092537, type 1 (EV_KEY), code 7 (KEY_6), value 1
Event: time 1501837315.092537, -------------- SYN_REPORT ------------
Event: time 1501837315.179209, type 1 (EV_KEY), code 7 (KEY_6), value 0
Event: time 1501837315.179209, -------------- SYN_REPORT ------------
Event: time 1501837316.033009, type 1 (EV_KEY), code 8 (KEY_7), value 1
Event: time 1501837316.033009, -------------- SYN_REPORT ------------
Event: time 1501837316.215876, type 1 (EV_KEY), code 8 (KEY_7), value 0
Event: time 1501837316.215876, -------------- SYN_REPORT ------------
Event: time 1501837316.618831, type 1 (EV_KEY), code 9 (KEY_8), value 1
Event: time 1501837316.618831, -------------- SYN_REPORT ------------
Event: time 1501837316.705897, type 1 (EV_KEY), code 9 (KEY_8), value 0
Event: time 1501837316.705897, -------------- SYN_REPORT ------------
Event: time 1501837317.125009, type 1 (EV_KEY), code 10 (KEY_9), value 1
Event: time 1501837317.125009, -------------- SYN_REPORT ------------
Event: time 1501837317.415869, type 1 (EV_KEY), code 10 (KEY_9), value 0
Event: time 1501837317.415869, -------------- SYN_REPORT ------------
Event: time 1501837318.266577, type 1 (EV_KEY), code 158 (KEY_BACK), value 1
Event: time 1501837318.266577, -------------- SYN_REPORT ------------
Event: time 1501837318.355877, type 1 (EV_KEY), code 158 (KEY_BACK), value 0
Event: time 1501837318.355877, -------------- SYN_REPORT ------------
Event: time 1501837319.090688, type 1 (EV_KEY), code 158 (KEY_BACK), value 1
Event: time 1501837319.090688, -------------- SYN_REPORT ------------
Event: time 1501837319.179209, type 1 (EV_KEY), code 158 (KEY_BACK), value 0
Event: time 1501837319.179209, -------------- SYN_REPORT ------------
Event: time 1501837319.699848, type 1 (EV_KEY), code 11 (KEY_0), value 1
Event: time 1501837319.699848, -------------- SYN_REPORT ------------
Event: time 1501837319.789204, type 1 (EV_KEY), code 11 (KEY_0), value 0
Event: time 1501837319.789204, -------------- SYN_REPORT ------------
Event: time 1501837320.142705, type 1 (EV_KEY), code 139 (KEY_MENU), value 1
Event: time 1501837320.142705, -------------- SYN_REPORT ------------
Event: time 1501837320.229168, type 1 (EV_KEY), code 139 (KEY_MENU), value 0
Event: time 1501837320.229168, -------------- SYN_REPORT ------------
Event: time 1501837321.620284, type 1 (EV_KEY), code 105 (KEY_LEFT), value 1
Event: time 1501837321.620284, -------------- SYN_REPORT ------------
Event: time 1501837321.709208, type 1 (EV_KEY), code 105 (KEY_LEFT), value 0
Event: time 1501837321.709208, -------------- SYN_REPORT ------------
Event: time 1501837322.118815, type 1 (EV_KEY), code 103 (KEY_UP), value 1
Event: time 1501837322.118815, -------------- SYN_REPORT ------------
Event: time 1501837322.205869, type 1 (EV_KEY), code 103 (KEY_UP), value 0
Event: time 1501837322.205869, -------------- SYN_REPORT ------------
Event: time 1501837322.636656, type 1 (EV_KEY), code 106 (KEY_RIGHT), value 1
Event: time 1501837322.636656, -------------- SYN_REPORT ------------
Event: time 1501837322.819202, type 1 (EV_KEY), code 106 (KEY_RIGHT), value 0
Event: time 1501837322.819202, -------------- SYN_REPORT ------------
Event: time 1501837323.318256, type 1 (EV_KEY), code 108 (KEY_DOWN), value 1
Event: time 1501837323.318256, -------------- SYN_REPORT ------------
Event: time 1501837323.405873, type 1 (EV_KEY), code 108 (KEY_DOWN), value 0
Event: time 1501837323.405873, -------------- SYN_REPORT ------------
Event: time 1501837323.817954, type 1 (EV_KEY), code 28 (KEY_ENTER), value 1
Event: time 1501837323.817954, -------------- SYN_REPORT ------------
Event: time 1501837323.905869, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
Event: time 1501837323.905869, -------------- SYN_REPORT ------------=
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Demonstration:
IIC Testing
Our user GPIO exposes two sets of I2C, namely I2C2 and I2C3.
To test I2C, we need devices mounted on the I2C bus. The I/O pins require pull-up resistors, and the corresponding device driver must be written to perform normal testing. Here, I'll use a brute-force approach for testing. Since the development board does not have pull-up resistors connected to the I2C pins, I can only test I2C2. This is because the I2C2 port is by default in a pull-up state, as shown in the schematic. You can see that GPIO0_B5/6_u indicates a pull-up (UP), and GPIO3_B5/6_d indicates a pull-down (D).
Hardware Connection
Testing
Use ADB to list the I2C devices.
rk3566_tspi:/ # ls /sys/class/i2c-dev/
i2c-0/ i2c-2/ i2c-3/ i2c-4/ i2c-6/
2
Write arbitrary data to the I2C-2 bus.
rk3566_tspi:/ # echo -n " " > /dev/i2c-2
Use a packet capture tool to observe the waveform output.
SPI Testing
The user GPIO exposes a set of SPI interfaces, as shown in the diagram below:
Hardware Connection
Here, we connect to a logic analyzer to visually observe the SPI communication data. We will analyze how to drive the sensors in later driver tutorials.
Testing
Commands for SPI testing using ADB:
# echo type id loop_count transfer_length > /dev/spi_misc_test
echo write 0 10 255 > /dev/spi_misc_test
echo write 0 10 255 init.rc > /dev/spi_misc_test
echo read 0 10 255 > /dev/spi_misc_test
echo loop 0 10 255 > /dev/spi_misc_test
# echo setspeed id frequency (in Hz) > /dev/spi_misc_test
echo setspeed 0 1000000 > /dev/spi_misc_test
2
3
4
5
6
7
8
For the write test, first start the logic analyzer sampling, then execute the following write command via ADB:
# Perform a write test on ID 0, with 1 loop, sending 0-255
rk3566_tspi:/ # echo write 0 1 255 > /dev/spi_misc_test
2
After stopping the sampling, the logic analyzer successfully captures the data we sent, confirming that SPI is functioning correctly.
PWM Testing
Many GPIO pins in the user GPIO can be multiplexed as PWM. You can refer to the multiplexing definition table, but here we follow the default configuration, so we will test pins 12, 33, and 35 for PWM functionality. The pin definitions are shown below:
Hardware Connection
Using a logic analyzer, we capture the output from the three PWM pins.
PWM Testing via ADB
Find the PWM device we want to test:
rk3566_tspi:/ # find . -name "pwm"
#pwm4: pwm@fe6e0000 edp screen backlight
./sys/devices/platform/fe6e0000.pwm/pwm
#pwm14: pwm@fe700020
./sys/devices/platform/fe700020.pwm/pwm
#pwm9: pwm@fe6f0010
./sys/devices/platform/fe6f0010.pwm/pwm
#pwm8: pwm@fe6f0000
./sys/devices/platform/fe6f0000.pwm/pwm
2
3
4
5
6
7
8
9
Here, we will test pwm8:
#Listing the pwm8 directory
rk3566_tspi:/ # ls /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/
device export npwm power subsystem uevent unexport
2
3
使能调试通道
# Channels start from 0, matching the pwmx_mx in the schematic. Here pwm8_m0 corresponds to channel 0
rk3566_tspi:/ # echo 0 > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/export
# After enabling, you’ll see an additional pwm0 directory
rk3566_tspi:/ # ls /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/
device export npwm power pwm0 subsystem uevent unexport
2
3
4
5
6
Set the PWM period, frequency, and polarity:
# Set the period in nanoseconds, 1,000,000,000 nanoseconds equals one second
rk3566_tspi:/ # echo 1000000000 > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/pwm0/period
# Set the duty cycle to 50%
rk3566_tspi:/ # echo 500000000 > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/pwm0/duty_cycle
# Polarity options: normal and inverted. In "normal" mode, high level indicates the high part of the duty cycle,
# and low level indicates the low part. In "inverted" mode, this is reversed.
rk3566_tspi:/ # echo 'normal' > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/pwm0/polarity
2
3
4
5
6
7
8
9
Start and stop PWM:
# Start PWM
rk3566_tspi:/ # echo 1 > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/pwm0/enable
# Stop PWM
rk3566_tspi:/ # echo 0 > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/pwm0/enable
2
3
4
Disable the debugging channel:
rk3566_tspi:/ # echo 0 > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/unexport
Testing
Output PWM signals simultaneously on channels PWM8, PWM9, and PWM10, and use a logic analyzer to capture the waveforms.
echo 0 > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/export
echo 0 > /sys/devices/platform/fe6f0010.pwm/pwm/pwmchip2/export
echo 0 > /sys/devices/platform/fe700020.pwm/pwm/pwmchip3/export
echo 1000000000> /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/pwm0/period
echo 1000000000 > /sys/devices/platform/fe6f0010.pwm/pwm/pwmchip2/pwm0/period
echo 1000000000 > /sys/devices/platform/fe700020.pwm/pwm/pwmchip3/pwm0/period
echo 500000000 > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/pwm0/duty_cycle
echo 250000000 > /sys/devices/platform/fe6f0010.pwm/pwm/pwmchip2/pwm0/duty_cycle
echo 100000000 > /sys/devices/platform/fe700020.pwm/pwm/pwmchip3/pwm0/duty_cycle
echo 'normal' > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/pwm0/polarity
echo 'normal' > /sys/devices/platform/fe6f0010.pwm/pwm/pwmchip2/pwm0/polarity
echo 'normal' > /sys/devices/platform/fe700020.pwm/pwm/pwmchip3/pwm0/polarity
echo 1 > /sys/devices/platform/fe6f0000.pwm/pwm/pwmchip1/pwm0/enable
echo 1 > /sys/devices/platform/fe6f0010.pwm/pwm/pwmchip2/pwm0/enable
echo 1 > /sys/devices/platform/fe700020.pwm/pwm/pwmchip3/pwm0/enable
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Demonstration: