Tinker Board 3 & 3S - TinkerBoard/TinkerBoard GitHub Wiki

1. Linux Development

1.1 Build image

1.1.1 Kernel 5.10

  1. Install Docker environment
  • Uninstall old versions
sudo apt-get remove docker docker-engine docker.io containerd runc
  • Install Docker Engine – Community
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world

Reference: https://docs.docker.com/engine/install/ubuntu/

  • Manage Docker as a non-root user
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world

Reference: https://docs.docker.com/engine/install/linux-postinstall/

  1. Download the source code:
repo init -u https://github.com/TinkerBoard-Linux/rockchip-linux-manifest.git -b linux5.10-rk356x
  1. Code compiling
  • Go to the directory where you have downloaded the code base and execute the script. This will take a while to install the necessary packages on the host and build the Docker image.
./docker_builder/docker-builder-run.sh

Once the above is done, you are in the shell of the newly started Docker container as the following. You can start to issue commands as usual.

Options to run docker: --privileged --rm -it --volume /mnt/2T-disk/linux5.10-rk356x_0620:/source
your_usernmae@292c696527f6:/source$
  • You can issue the following command to build all the images for Debian. All the images will be saved in the directory rockdev.
./build.sh rockchip_rk3566_tinker_board_3_debain_defconfig
./build.sh

It will generate a file which named sdcard_full.img and located at [source tree]/rockdev/sdcard_full.img

  • You can issue the following command to build all the images for Yocto. All the images will be saved in the directory rockdev.
./build.sh rockchip_rk3566_tinker_board_3_yocto_defconfig
./build.sh

It will generate a file which named sdcard_full.img and located at [source tree]/rockdev/sdcard_full.img

  1. Compiling u-boot/Kernel/Debian separately
  • u-boot
./build.sh uboot

It will generate a file which named uboot.img and located at [source tree]/u-boot/uboot.img

  • Kernel
./build.sh kernel

It will generate a file which named boot.img and located at [source tree]/kernel/boot.img

  • Debian
./build.sh debian

It will generate a file which named linaro-rootfs.img and located at [source tree]/debian/linaro-rootfs.img

  • Yocto
./build.sh yocto

It will generate a file which named linaro-rootfs.img and located at [source tree]/ yocto/build/latest/rootfs.img

 

1.2 Flash image

1.2.1 Booting from external Micro SD card

  • Requirement:
    • 1 x Micro SD card with at least 8GB capacity
    • 1 x 12~19V, DC 5.5/2.5 power supply
    • 1 x Monitor with HDMI™ cable or Micro USB cable
    • 1 x Keyboard and Mouse set

  • Setting Up:

  1. Insert the micro SD card into a Windows® PC.

  2. Download the TinkerOS image from the Tinker Board website (https://tinker-board.asus.com/download.html) and burn it into the micro SD card using a third-party ISO software, such as Etcher.

  3. Insert the bootable micro SD card into your Tinker Board 3, then connect the power supply, keyboard, mouse, and monitor to boot up.

 

1.2.2 Booting from onboard eMMC (Flash emmc by emmc UMS mode)

  • Requirement:
    • 1 x Micro USB cable with data transfer function
    • 1 x 12~19V, DC 5.5/2.5 power supply
    • 1 x Monitor with HDMI™ cable or Micro USB cable
    • 1 x Keyboard and Mouse set

  • Setting Up:

  1. Keep the dip1 pin of MASK1 to Right

    圖片1

  2. Connect the Tinker Board 3 to a PC using a Micro USB cable.

  3. Connect the power adapter to the Tinker Board 3.

  4. Download the TinkerOS image from the Tinker Board website (https://tinker-board.asus.com/download. html) and burn it into the Tinker Board 3 using a third-party ISO software, such as Etcher.

  5. After the TinkerOS image is successfully burned, disconnect all cables from the Tinker Board 3.

  6. Connect the power supply, keyboard, mouse, and monitor to your Tinker Board 3 to boot up.

1.2.3 How to recover a failed flash

  1. Insert the micro SD card into a Windows® PC.

  2. Download the TinkerOS image from the Tinker Board website (https://tinker-board.asus.com/download.html) and burn it into the micro SD card using a third-party ISO software, such as Etcher.

  3. Insert the SD card to Tinker Board 3 -> Keep the dip1 pin of MASK1 to Right

    圖片2

  4. Connect the Tinker Board 3 to a PC using a Micro USB cable.

  5. Connect the power adapter to the Tinker Board 3.

  6. Download the TinkerOS image from the Tinker Board website (https://tinker-board.asus.com/download. html) and burn it into the Tinker Board 3 using a third-party ISO software, such as Etcher.

  7. After the TinkerOS image is successfully burned, disconnect all cables and remove the sd card from the Tinker Board 3

  8. Connect the power supply, keyboard, mouse, and monitor to your Tinker Board 3 to boot up.

 

1.3 How to Check Image Version

You can issue the following command to get the version of the image.

cat /etc/version

 

1.4 How to Get the SN (PPID)

Note: PPID (unique ID for Tinker board)

  1. Copy the tinker_3_read_sn.zip file to device.

    tinker_3_read_sn.zip

  2. Unzip tinker_3_read_sn.zip.

  3. You can issue the following command to get the serial number.

sudo bash tinker_3_read_sn.sh

 

1.5 Resize image/partition

Purpose:

Providing a method to create a minimized image from an existing storage and this image is also able to restore back to the storage of the next board.

The environment:

  • Board: Tinker Board 3

  • OS: Tinker_Board_3-Debian-Bullseye-v1.0.2-20240612-debug

  • microSD card: With another Debian installed (It could be flashed an image thru Etcher or Win32DiskImager under Windows environment or dd under Linux.)

Procedures:

  1. Insert microSD card to the Tinker Board 3

  2. Power on the Tinker Board 3 and it would boot from microSD card

  3. Install gparted by the following command: (Ensure the Ethernet/WIFI is workable)

    圖片1

    圖片2

  4. There’re 3 methods to run Gparted app:

    a) Execute it with following command on Terminal:

    圖片4

    b) Execute it from “Run Program…” app and key-in “GParted” on the popped-up window:

    圖片5

    c) Execute it from GParted icon as shown below:

    圖片6

  5. It would pop-up a window to request the permission as below: (the password is linaro)

    圖片7

  6. Following steps to resize eMMC thru GParted:

    a) Select a partition mmcblk0 (the live partition cannot be resized)

    • Select mmckblk0 which indicates to the eMMC.

    圖片8

    b) Click the green arrow

    • Select /dev/mmcblk0p8 and click grey arrow.

    圖片9

    c) Pop-up a resize window

    • You could set the size either one of the ovals.

      (If you set the new size as the minimum size, it might not work. It needs some space to process resizing.)

    圖片10

    d) After setting resize, it would be like below shown, then click “Resize/Move” to confirm the size

    • After setting the size, click “Resize/Move”.

      (This step just confirms the size, not execute resize yet.)

    圖片11

    e) It would like below, then click another green arrow

    • Click another green arrow.

    圖片12

    f) Pop-up a warning, and click “Apply” to execute resize

    • Click “Apply” into resize processing.

    圖片13

    g) Resize is processing

    圖片14

    h) Click “Close” to finish the procedure

    圖片15

    i) Finally, the eMMC capacity was resized from 14.31GB to 4.88GB

    圖片16

  7. Now, this eMMC is ready to be created as an image by dd/Win32DiskImager/Etcher.

  8. Then the created image could be restored back to the whole storage of the next board, without resizing the capacity again.

 

1.6 How to change LOGO

  • For Debian OS

  • Method 1:

  1. Convert the logo file to 24 bit BMP file. It is recommended to use Window Paint for conversion.

    Note: After converting to 24 bit BMP file, the BMP file MUST less than 700K bytes.

  2. Rename the BMP file to logo.bmp

  3. Copy logo.bmp and rename it to logo_kernel.bmp

  4. Replace logo.bmp and logo_kernel.bmp with logo.bmp and logo_kernel.bmp under sourcecode/kernel.

  5. Build kernel image and flash kernel image.

 

  • Method 2:
  1. Convert the logo file to 24 bit BMP file. It is recommended to use Window Paint for conversion

    Note: After converting to 24 bit BMP file, the BMP file MUST less than 700K bytes.

  2. Rename the BMP file to logo.bmp

  3. Copy logo.bmp to sourcecode/kernel/scripts/

  4. Execute the following command on the ubuntu server:

    ./bmpconvert logo.bmp
    
  5. You will see the following message after the command is successful

    Execute follow command to enter fastboot mode

    adb reboot fastboot
    
  6. Execute follow command to flash logo.bmp into splash partition

    fastboot flash splash logo.bmp
    
  7. Reboot device

 

1.7 How to create Swapfile

In this example, we will create and activate 1G of swap. To create a bigger swap, replace 1G with the size of the desired swap space.

The steps below show how to add swap space on Debian 11.

  1. First create a file which will be used for swap:

    sudo fallocate -l 1G /swapfile
    
  2. Only the root user should be able to read and write to the swap file. Issue the command below to set the correct permissions:

    sudo chmod 600 /swapfile
    
  3. Use the mkswap tool to set up a Linux swap area on the file:

    sudo mkswap /swapfile
    
  4. Activate the swap file:

    sudo swapon /swapfile
    
  5. To make the change permanent open the /etc/fstab file:

    sudo vim /etc/fstab
    

    and paste the following line:

    /swapfile swap swap defaults 0 0
    
  6. Verify whether the swap is active using either the swapon or free command as shown below:

    sudo swapon --show
    
    Output
    NAME      TYPE  SIZE   USED PRIO
    /swapfile file 1024M   0B   -2
    
    sudo free -h
    
    Output
                   total        used        free      shared  buff/cache   available
    Mem:           3.8Gi        162Mi       3.4Gi      4.0Mi    279Mi        3.6Gi
    Swap:          1.0Gi                    0B         1.0Gi    
    
    

Reference link: https://linuxize.com/post/how-to-add-swap-space-on-debian-10/

 

1.8 Power management tool

  1. Open a terminal in full screen mode and run the following command:

    tinker-power-management
    
  2. Adjust CPU or GPU Governor:

    a. Press 'C' or 'G' to open the menu. 'C' is for CPU Governor and 'G' is for GPU Governor. There are 4 options to select: "auto", "manual", "powersave", and "performance".

    b. Use the left or right arrow key to select. Option selected is shown in bold. Press the space bar to confirm, or press 'q' to cancel.

  3. Adjust CPU frequency:

    a. Follow Step 2 above to adjust CPU or GPU Governor to "manual"

    b. Take CPU as example: When CPU Governor = manual, options for CPU frequency adjustment will be highlighted. There are 2 options: "min.freq for A55" and "max.freq for A55". Use the arrow keys to select. Option selected is shown in bold. Press the space bar to confirm and open the selected CPU frequency menu. *Follow step 2. to adjust CPU or GPU Governor.

    c. Once the frequency menu is shown Use the left or right arrow key to select. Option selected is shown in bold. Press the space bar to confirm, or press 'Q' to cancel. *Frequency menu needs to be confirmed or closed before adjusting CPU or GPU Governor again.

  4. Press "Ctrl" + "C" to exit Tinker Power Management anytime.

 

1.9 How to use power manager APP

  • CPU(A55) Governor setting is in /sys/devices/system/cpu/cpufreq/policy0/scaling_governor, use 'echo' to change.

    EX: echo ondemand > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor

    CPU(A55) minimum frequency: /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

    CPU(A55) maximum frequency: /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

Note: Check available parameter for CPU(A55) in /sys/devices/system/cpu/cpu0/cpufreq before setting.

  • GPU(G52) Governor setting: /sys/class/devfreq/fde60000.gpu/governor

    GPU minimum frequency: /sys/class/devfreq/fde60000.gpu/min_freq

    GPU maximum frequency: /sys/class/devfreq/fde60000.gpu/max_freq

Note: Check available parameter for GPU(G52) in /sys/class/devfreq/fde60000.gpu before setting.

 

1.10 How to Install OpenCV

  1. The OpenCV Python module is available from the Debian repository, so first, use the following command to update the packages list:

    sudo apt update
    
  2. And to obtain the OpenCV Python Module, execute the following line in the terminal:

    sudo apt install python3-opencv
    

Reference: https://vegastack.com/tutorials/how-to-install-opencv-on-debian-11/

 

1.11 How to control the reserved LED

Use the terminal to enter commands

  • Bright on the reserved led
    echo 1 > /sys/devices/platform/gpio-leds/leds/rsv-led/brightness

  • Bright off the reserved led
    echo 0 > /sys/devices/platform/gpio-leds/leds/rsv-led/brightness

 

1.12 How to set WIFI as a Hotspot

  1. Install dnsmasq & hostapd package

    sudo apt install dnsmasq hostapd 
    
  2. Unzip SoftAP.zip

    SoftAP_debian10_20220127.zip

  3. Open terminal and go to SoftAP folder, then

    chmod 755 Enable_SoftAP.sh Disable_SoftAP.sh 
    
  4. Enable SoftAP mode:

    ./Enable_SoftAP.sh 
    default SSID = TinkerSoftAP 
    default Password = 87654321 
    
  5. Disable SoftAP mode:

     ./Disable_SoftAP.sh 
    
  6. You can modify /etc/hostapd/hostapd.conf for your own softap settings.

    Ex.
    ssid=TinkerSoftAP
    wpa_passphrase=87654321
    channel=6

    # For MAC address access-list 
    # 0 = accept unless in deny list, deny_mac_file is used to specify deny list. 
    # 1 = deny unless in accept list, accept_mac_file is used to specify accept list. 
    macaddr_acl=1
    
    # Accept/deny lists are read from separate files (containing list of # MAC addresses, one per line). 
    accept_mac_file=/etc/hostapd/hostapd.accept 
    deny_mac_file=/etc/hostapd/hostapd.deny 
    

    After modify hostapd.conf, you need to disable / re-enable softap again.

 

1.13 How to run the application at startup

Applications can be automatically started in a couple of ways:

  1. Via GUI

    a. Click Applications Menu > Settings > Settings Manager and then choose the Session and Startup option

    圖片1

    b. Click “Apllication Autostart”

    圖片2

    c. Add application name by the following item

    圖片3

    d. Click “OK” button to get the following item.

    圖片4

  2. Via config file

    a. Edit autostart file

    vim ~/.config/autostart/termianl-xfce4.desktop
    

    b. Add application contents

    For example: Execute the xfce4-terminal autostart

    圖片5

Reference link: https://wiki.archlinux.org/title/xfce

 

1.14 How to set a script from startup

  • For Debian OS

Sample setting for starting up the applications when into Debian
This is a sample to print logs into dmesg, to set the applications will automatically run when into the Debian system.

  1. Create tb3_start.sh or copy tb3_start.sh file into /usr/local/bin/ folder

    root@linaro-alip:/# vi /usr/local/bin/tb3_start.sh
    #!/bin/bash
    echo "tinker board 3 start up !!" > /dev/kmsg
    
  2. Setting the permission

    root@linaro-alip:/# chmod a+x /usr/local/bin/tb3_start.sh
    
  3. Create tb3-start.service or copy tb3-start.service into /lib/systemd/system/ folder

    root@linaro-alip:/# sudo vi /lib/systemd/system/tb3-start.service
    [Unit]
    Description=Tinker Board 3 Start up Service
    
    [Service]
    Type=simple
    WorkingDirectory=/usr/local/bin
    ExecStart=/bin/bash /usr/local/bin/tb3_start.sh
    
    [Install]
    WantedBy=multi-user.target
    
  4. Execute below command to enable service

    systemctl enable tb3-start.service
    
  5. Reboot the Debian system and the message “tinker board 3 start up !!” will be shown on dmesg.

 

1.15 How to collect log

  • For Debian OS
  1. Open Terminal and text the following command:

    sudo tar -cvf /home/linaro/Desktop/$(date +'%Y%m%d_%H%M')_log.tar /var/log
    
  2. Generate the file name like the following example

    ls ~/Desktop/
    
    20230908_0313_log.tar
    
  3. Decompress the tar

    tar -xvf 20230908_0313_log.tar
    

1.16 ASUS API Documentation

 

1.17 How to switch HDMI or DSI display

The default display is HDMI, you can use the following steps to switch to DSI.

Enable LKW070N13000-V2 touch panel:

Use terminal to modify the /boot/config.txt file and reboot the device.

  1. Enable i2c5
from #intf:i2c5=off 
to   intf:i2c5=on
  1. Disable HDMI and Enable DSI0
from conf:HDMI=on
     conf:DSI0=off

to   conf:HDMI=off
     conf:DSI0=on
  1. Add panel and touch dtbo
from overlay=
to   overlay=i2c5_ilitek dsi_LKW070N13000-V2

 

2. Android Development

2.1 Android Build Instructions

  • Establish a build environment

Please refer to Install Docker Engine to install Docker engine.

  • Download the Android source

Please refer to Installing Repo to install the Repo Launcher and Downloading the Source to understand how to download the Android source.

  • Initiale a Repo client

Run repo init to get the latest version of Repo with its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source are placed within your working directory. For different projects, you must also specify the manifest branch or revision with option "-b REVISION".

repo init -u https://github.com/TinkerBoard-Android/rockchip-android-manifest.git -b REVISION

Optionally, you can also specify the initial manifest file with "-m NAME.xml" for the specific release for that project.

repo init -u https://github.com/TinkerBoard-Android/rockchip-android-manifest.git -b REVISION -m NAME.xml
  • Android 14: ( For Tinker Borad 3 )
repo init -u https://github.com/TinkerBoard-Android/rockchip-android-manifest.git -b android14-rockchip
  • Download the Android source tree To download the Android source tree to your working directory from the repositories as specified in the default manifest, run:
repo sync
  • Build Android

Go to to the directory where you have downloaded the Android source and execute the script as the following. This will take a while to install the necessary packages on the host, build the Docker image, and start the container:

./docker_builder/docker-builder-run.sh

Once it is done, you are in the shell of this newly started Docker containerm and you are ready to build Android.

  • Android 14: ( For Tinker Board 3 )
source build/envsetup.sh
lunch Tinker_Board_3-userdebug
./build.sh -UCKAu

The image which is able to be flashed to the board via UMS mode will be stored as the following in the directory where you have downloaded the source.

  ./rockdev/Image-Tinker_Board_3/Tinker_Board_3-raw.img

2.2 Flash Image

2.2.1 Booting from external Micro SD card

  • Requirement:

    • 1 x Micro SD card with at least 8GB capacity
    • 1 x 12~19V, DC 5.5/2.5 power supply
    • 1 x Monitor with HDMI™ cable or Micro USB cable
    • 1 x Keyboard and Mouse set
  • Setting Up:

  1. Insert the micro SD card into a Windows® PC.

  2. Download the TinkerOS image from the Tinker Board website (https://tinker-board.asus.com/download.html) and burn it into the micro SD card using a third-party ISO software, such as Etcher.

  3. Insert the bootable micro SD card into your Tinker Board 3, then connect the power supply, keyboard, mouse, and monitor to boot up.

2.2.2 Booting from onboard eMMC

  • Requirement:

    • 1 x Micro USB cable with data transfer function
    • 1 x 12~19V, DC 5.5/2.5 power supply
    • 1 x Monitor with HDMI™ cable or Micro USB cable
    • 1 x Keyboard and Mouse set
  • Setting Up:

    1. Flash emmc by emmc UMS mode

    1.Keep the dip1 pin of MASK1 to Right

image

2.Connect the Tinker Board 3 to a PC using a Micro USB cable.

3.Connect the power adapter to the Tinker Board 3.

4.Download the TinkerOS image from the Tinker Board website (https://tinker-board.asus.com/download. html) and burn it into the Tinker Board 3 using a third-party ISO software, such as Etcher.

5.After the TinkerOS image is successfully burned, disconnect all cables from the Tinker Board 3.

6.Connect the power supply, keyboard, mouse, and monitor to your Tinker Board 3 to boot up.

2. Flash emmc by SD card UMS mode

1.Insert the micro SD card into a Windows® PC.

2.Download the TinkerOS image from the Tinker Board website (https://tinker-board.asus.com/download.html) and burn it into the micro SD card using a third-party ISO software, such as Etcher.

3.Insert the SD card to Tinker Board 3 -> Keep the dip1 pin of MASK1 to Right

image

4.Connect the Tinker Board 3 to a PC using a Micro USB cable.

5.Connect the power adapter to the Tinker Board 3.

6.Download the TinkerOS image from the Tinker Board website (https://tinker-board.asus.com/download. html) and burn it into the Tinker Board 3 using a third-party ISO software, such as Etcher.

7.After the TinkerOS image is successfully burned, disconnect all cables and remove the sd card from the Tinker Board 3

8.Connect the power supply, keyboard, mouse, and monitor to your Tinker Board 3 to boot up.

2.3 How to use adb

  1. Prepare an USB micro-B to Type-A cable

  2. Enable USB debugging in the device system settings, under Developer options.

  3. The Developer options screen is hidden by default. To make it visible, go to Settings > About tablet and tap Build number seven times. Return to the previous screen to find Developer options at the System > Advanced.

  4. You can now connect your device with USB. Connect cable micro-B side to Tinker Board 3 and Type-A side to PC.

  5. You can verify that your device is connected by check Device Manager.

    圖片3

  6. If you have ever installed the ASUS_Android_USB_drivers_for_Windows, the device will appear as ASUS Android device.

    圖片4

  7. Executing adb devices from the android_sdk/platform-tools/ directory. If connected, you'll see the device name listed as a device. The platform-tools can download from android website.

    圖片5

Ref: Android Debug Bridge (adb) | Android Developers (https://developer.android.com/tools/adb)

 

2.4 Get log file through adb

  • For Logcat:
adb logcat > logcat.txt

Logcat will save as logcat.txt

  • For Kernel:
adb shell dmesg > kernel.txt

Logcat will save as kernel.txt

Reference:
https://developer.android.com/studio/command-line/adb
https://developer.android.com/studio/command-line/logcat

 

2.5 How to use ASUS debugger

This file describes behaviors with the new version - AsusdeDugger v3.11

  1. Start AsusDebugger

    You CAN’T find AsusDebugger icon in Launcher, now. Please get into it from "Setting" Application

    1. In Launcher, You can find Setting APK. Click to start Setting.

    2. Click “About tablet” on the bottom of the list of the preference

    1. Click “Android Version” preference.
    1. Continuously click “Kernel version“ preference 10 times and will start open the AsusDebugger.

    Note: There is a quick way. Please see Section 6

  2. Set the configuration of logs

    1. The path of capturing logs is shown at "Log file location", it is default set to "/sdcard/Logs"

    2. "Logcat/kernel/tcpdump rotate number" is used to decide the number of log rotation. It affects logcat, kernel, and tcpdump.

    3. "Logcat/kernel file size" is used to decide the size of log files. It affects logcat, and kernel.

    4

  3. Start to catch logs

    1. In Debugger, the logcat logs and kernel logs have been separated, if you need "Enable capture logcat" and "Enable capture kernel", make sure those toggles are checked.

    5

    1. To enable tcpdump log for debugging internet related issue, make sure "Enable tcpdump" toggle is checked.

    6

  4. Collecting Logs

    1. When a bug is found, please press "COLLECT LOGS" button in AsusDebugger. You can describe your findings with short log or simply leave it blank.

    7

    1. AsusDebugger runs dumpstate automatically when you request collecting logs and it will take some time (1~2 minutes) to generate current system state and information.

    8

    Moreover, AsusDebugger collect logs you captured. Once collecting procedure is done, a dialog will be prompted to inform you of the path of the collected logs as follow.

    9

  5. Output Debugger files

    1. After connecting device to computer, drag the status bar and press "USB connected". Then select "File transfers"

    10

    11

    1. Log files in /sdcard/logs are logs for current capture session.

    2. All collected logs go to /sdcard/Logs_collected/ directory

  6. Quickly enter AsusDebugger

    In Section 3 - "Start to catch logs", if any log toggles are enabled, you can see a notification shown the Logging mode is Debugger. You can quickly get into AsusDebugger activity by clicking.

    12

  7. Other function

    1. Detect reboot

      If you want to detect whether the device is rebooted, make sure "Detect reboot" toggle is checked.

      12

      If detect the device is rebooted, there is a full-screen floating window shown and display timestamp. Remove window by clicking it.

      13

    2. Display usage

      If you want to know the device’s usage, includes the information of CPU, Memory, and Battery, make sure "Display CPU/GPU/MEM usage and battery level" toggle is checked. A floating window displays information at right-bottom corner.

      14

      15

    3. Ping test

      If you want to test the network connection, can use "Run PING test command" to run ping test

      16

      17

 

2.6 Changing the boot logo

2.6.1 Changing the boot logo

  1. Launch Tinker Config App

    圖片1

  2. Press “Boot Logo” button.

    圖片2

  3. Press “Change Image” button.

    圖片3

  4. Select the image(size limit: 233k pixels / 700KB) you want to set, and press “Apply” button.

    圖片4

  5. Reboot the device, you can get your own boot logo.

2.6.2 Changing the boot animation

  1. Requirements

    a. Micro USB cable

    b. bootanimation.zip file

    (You can create a bootanimation.zip by yourself or download it from the Internet.)

  2. Connect Tinker Board 3 to PC with Micro USB cable.

  3. Push bootanimation.zip to Tinker Board 3

    $ adb root
    $ adb remount
    $ adb push bootanimation.zip /system/media/bootanimation.zip
    $ adb reboot
    
  4. After reboot, you can get your own Android boot animation.

 

2.7 Tinker config application

Introduction

Tinker Config is an Android-based application that offers flexibility and an easy way to configure I/O interfaces on 40pin header, the MIPI DSI connector as well as Linux kernel Device tree overlays while using Tinker Board 3.

圖片1

Prerequisites

Tinker Board 3 with Android 14 OS v.1.0.1 (or later) installed. For image installation, please visit Tinker Board’s wiki page on Github.
Optional: hardware accessories such as LED modules, monitors … etc.
Tinker Config is built-in and can be found in the app list.

圖片2

Features

  • Interface: allows users to configure functions for 40 pin GPIO header. The complete GPIO config table can be found on Github wiki. Below are the supported functions:

    UART Settings: UART0, UART1, UART4

    I2C Settings: I2C1, I2C5

    AUDIO Settings: I2S3_2CH, SPDIF_8CH

    SPI Settings: SPI2 SPI3

    PWM Settings: PWM0, PWM1, PWM2, PWM5, PWM7, PWM8

    OTHER Settings: XIN32K, AUTO_UMS

    圖片4

    Reset the all functions to default setting icon:
    圖片5

    Note: Changes will not take effect immediately, please reboot the board each time after changes are made.

  • Linux Kernel Devicetree Overlays: For DSI panel and touch support to change configuration.

    Device tree blob (DTB) supported include: dsi_LKW070N13000-V2, dsi_in_main_display_LKW070N13000-V2, i2c5_ilitek, mipi2edp_G156HAB02

    圖片6

    Note: Changes will not take effect immediately, please reboot the board each time after changes are made.

  • Application Whitelisting: allows users to prevent running applications being terminated when out of memory (OOM) occurred. Applications ticked in the Whitelist will be allowed running when OOM.

    圖片7

    Note: Changes will not take effect immediately, please reboot the board each time after changes are made.

  • Power Management: users can scale the CPU and GPU frequency in order to either save power or enhance improvement. Below are the supported options of power policies:

    CPU:
    Governor: interactive, conservative, ondemand, userspace, powersave, performance, schedutil
    Core Frequency: 408000, 600000, 816000, 1104000, 1416000, 1608000, 1800000

    GPU:
    Governor: rknpu_ondemand, dmc_ondemand, vop2_ondemand, vdec2_ondemand, venc_ondemand, userspace, powersave, performance, simple_ondemand

    USB:
    Enable, Disable, and Reset the power of USB3.0 and USB2.0

    圖片8

    圖片9

    圖片10

  • Boot Logo: This feature allows user to change the image shown when the board is booting.
    Select an image (size limit: 233k pixels / 700KB), click “Change image“, and click “Apply”.

    圖片11

    圖片12

    Note: Changes will not take effect immediately, please reboot the board each time after changes are made.

    The boot image change stays even when the board is reset to factory settings. Please wipe and re-flash the OS image to change boot logo back to default settings.

  • Power Scheduling: Allow users to set a scheduler to boot or shutdown the devices, users can be notified by SMS, email or system notification before the scheduler is triggered.

    圖片13

    Add scheduler: Click the “+” icon button at the corner, choose the action, execution time, repeat, and notification and press “Save”.

    圖片14

    Note: The default status of a new scheduler is disable, please remember to enable it by clicking the toggle button on the right side of the scheduler.

    Modify scheduler: Click the scheduler to be modified, after setting the scheduler, press “Apply”.
    Delete scheduler: Click the scheduler to be deleted, then click the delete button.

    圖片15

    Notification: Enable or disable the notification and set the notify time before the scheduler triggered.

    圖片16

    The mail server settings can be set up by clicking the “Set up” button.

    圖片17

    History: Shows the scheduler related logs and the reasons for the last shutdown.

    圖片18

 

2.8 Root Permission Control

Enabling root access grants full control of the system. Incorrect operations may cause system instability, data loss, or permanent device damage. Proceed only if you fully understand the risks.

Supported on firmware version v1.0.9(Android 14) and later.

  1. Select "Setting" > "About tablet". Scroll down to find "Build number"

WIN_20250819_11_16_54_Pro

  1. Click "Build number" continuously. Until "You are now a developer!" notification pop up.

WIN_20250819_11_17_21_Pro

  1. Select "System" > "Developer options".

WIN_20250819_11_17_54_Pro

  1. You will see "Get rooted". Enable "Get rooted" to get root permission.

WIN_20250819_11_18_11_Pro

2.9 Kiosk Setting APP

WIN_20251014_13_48_28_Pro

  1. Kiosk mode: Used to enable/disable Kiosk mode. After enabling kiosk mode, the following options can be selected. Leave this page and the settings will be activated. Press Back key or Home Key to leave this page.

    If kiosk mode is enabled, the screen will be locked to a fixed app, or several apps you set.

  2. Allowed apps: Used to select apps that can be used and switched in the kiosk mode.

  3. Auto launch app: Apps to automatically open after leaving the kiosk setting. Only one can be set.

  4. Auto Start: Choose whether to automatically start the auto launch app after restarting the device.

  5. Password protection: If you set a password, you need to enter the password to enter the Kiosk Setting app.

  6. Show navigation bar in app: Whether the app displays the navigation bar when it is in kiosk mode.

  7. Display button: If Item 6 is enabled, you can select the key for the navigation bar to display.

  8. Exit gesture: When the app is locked in the foreground, you can exit the app using the exit gesture.

 

3. Hardware Guide

3.1 How to set a serial port console log

Hardware:

  • Tinker Board 3

    圖片1

  • Usb serial cable

    圖片2

  1. Connect Tinker Board 3 to PC with a USB serial cable

  2. On PC, open Putty and select Serial.

  3. The Serial line can be checked from Windows >Device Manager >Ports (COM & LPT). The speed is 1500000 baud.

    圖片3

  4. Click the Open button on Putty and power the board, and some boot logs will be printed on Putty from PC:

    圖片4

 

3.2 How to use GPIO

3.2.1 GPIO config table

Chip, line Device Path Function3 Function2 Function1 GPIO Pin# Pin# GPIO Function1 Function2 Device Path Chip, line
VCC3.3V_IO 1 2 VCC5V_SYS
0, 12 GPIO: /sys/class/gpio/gpio12 I2C: /dev/i2c-1 I2C1_SDL GPIO0_B4 3 4 VCC5V_SYS
0, 11 GPIO: /sys/class/gpio/gpio11 I2C: /dev/i2c-1 I2C1_SCA GPIO0_B3 5 6 GND
0, 8 GPIO: /sys/class/gpio/gpio8 CLK32K_IN CLK32K_OUT0 GPIO0_B0 7 8 GPIO0_C1 UART0_TX PWM2_M0 GPIO: /sys/class/gpio/gpio17 UART: /dev/ttyS0 0, 17
GND 9 10 GPIO0_C0 UART0_RX PWM1_M0 GPIO: /sys/class/gpio/gpio16 UART: /dev/ttyS0 0, 16
4, 18 GPIO: /sys/class/gpio/gpio146 PWM14_M1 SPI3_CLK_M1 GPIO4_C2 11 12 GPIO3_A3 I2S3_SCLKM0 GPIO: /sys/class/gpio/gpio99 3, 3
4, 19 GPIO: /sys/class/gpio/gpio147 SPI: /dev/spidev3 PWM15_IR_M1 SPI3_MOSI_M1 GPIO4_C3 13 14 GND
4, 21 GPIO: /sys/class/gpio/gpio149 SPI: /dev/spidev3 UART9_TX_M1 PWM12_M1 SPI3_MISO_M1 GPIO4_C5 15 16 GPIO0_C7 UART0_CTSn PWM0_M1 GPIO: /sys/class/gpio/gpio23 0, 23
VCC3.3V_IO 17 18 GPIO0_C4 UART0_RTSn PWM5 GPIO: /sys/class/gpio/gpio20 0, 20
2, 19 GPIO: /sys/class/gpio/gpio83 SPI: /dev/spidev2 SPI2_MOSI_M0 GPIO2_C3 19 20 GND
2, 18 GPIO: /sys/class/gpio/gpio82 SPI: /dev/spidev2 SPI2_MISO_M0 GPIO2_C2 21 22 GPIO3_C5 SPDIF_TX_M1 PWM15_IR_M0 GPIO: /sys/class/gpio/gpio117 3, 21
2, 17 GPIO: /sys/class/gpio/gpio81 SPI: /dev/spidev2 SPI2_CLK_M0 GPIO2_C1 23 24 GPIO2_C4 SPI2_CS0_M0 GPIO: /sys/class/gpio/gpio84 SPI: /dev/spidev2.0 2, 20
GND 25 26 GPIO2_C5 SPI2_CS1_M0 GPIO: /sys/class/gpio/gpio85 SPI: /dev/spidev2.1 2, 21
3, 12 GPIO: /sys/class/gpio/gpio108 I2C: /dev/i2c-5 I2C5_SDA_M0 GPIO3_B4 27 28 GPIO3_B3 I2C5_SCL_M0 GPIO: /sys/class/gpio/gpio107 I2C: /dev/i2c-5 3, 11
4, 22 GPIO: /sys/class/gpio/gpio150 UART9_RX_M1 PWM13_M1 SPI3_CS0_M1 GPIO4_C6 29 30 GND
0, 22 GPIO: /sys/class/gpio/gpio22 PWM7_IR GPIO0_C6 31 32 GPIO3_B2 UART4_TX_M1 PWM9_M0 GPIO: /sys/class/gpio/gpio106 UART: /dev/ttyS4 3, 10
3, 9 GPIO: /sys/class/gpio/gpio105 PWM: /sys/class/pwm/pwmchip1 PWM8_M0 UART4_RX_M1 GPIO3_B1 33 34 GND
3, 4 GPIO: /sys/class/gpio/gpio100 I2S3_LRCKM0 GPIO3_A4 35 36 GPIO2_B3 UART1_RX_M0 GPIO: /sys/class/gpio/gpio75 UART: /dev/ttyS1 2, 11
2, 12 GPIO: /sys/class/gpio/gpio76 UART: /dev/ttyS1 UART1_TX_M0 GPIO2_B4 37 38 GPIO3_A6 I2S3_SDI_M0 GPIO: /sys/class/gpio/gpio102 3, 6
GND 39 40 GPIO3_A5 I2S0_SDO_M0 GPIO: /sys/class/gpio/gpio101 3, 5
  • Input control example

    # Export the GPIO pin (For example. pin#11)
    echo 11 > /sys/class/gpio/export
    # Set the GPIO pin to INPUT mode
    echo in > /sys/class/gpio/gpio11/direction
    # Get the value
    cat /sys/class/gpio/gpio11/value
    
  • Output control example

    # Export the GPIO pin (For example. pin#11)
    echo 11 > /sys/class/gpio/export
    # Set the GPIO pin to INPUT mode
    echo out > /sys/class/gpio/gpio11/direction
    # Pull the GPIO to HIGH (0 for LOW)
    echo 1 > /sys/class/gpio/gpio11/value
    

 

3.2.2 GPIO Driving

Chip, line Current Drive Strength PWR Pull external pull up/down Name Physical Pin Physical Pin Name external pull up/down Pull PWR Drive strength Current Chip, line
600mA *Note2 3.3V VCC3V3_40PIN 1 2 VCC5V0_40PIN 5V *Note3 2A
0,11 3mA Level 0 *Note1 3.3V up 2.2K up 3.3V 40_GP0B3_I2C1_SDA 3 4 VCC5V0_40PIN 5V *Note3 2A
0,12 3mA Level 0 *Note1 3.3V up 2.2K up 3.3V 40_GP0B4_I2C1_SCL 5 6 GND 0V
0,8 3mA Level 0 *Note1 3.3V up 10K up 3.3V 40_GP0B0_CLK32K_OUT0 7 8 40_GP0C1_UART0_TX down 3.3V Level 0 *Note1 3mA 0,17
0V GND 9 10 40_GP0C0_UART0_RX down 3.3V Level 0 *Note1 3mA 0,16
4,18 5mA Level 1 *Note1 3.3V down 40_GP4C2_SPI3_CLK_M1 11 12 40_GP3A3_I2S3_SCLK_M0 down 3.3V Level 1 *Note1 5mA 3,3
4,19 5mA Level 1 *Note1 3.3V down 40_GP4C3_SPI3_MOSI_M1 13 14 GND 0V
4,21 5mA Level 1 *Note1 3.3V down 40_GP4C5_SPI3_MISO_M1 15 16 40_GP0C7_UART0_CTSn down 3.3V Level 0 *Note1 3mA 0,23
600mA *Note2 3.3V VCC3V3_40PIN 17 18 40_GP0C4_UART0_RTSn down 3.3V Level 0 *Note1 3mA 0,20
2,19 5mA Level 1 *Note1 3.3V down 40_GP2C3_SPI2_MOSI_M0 19 20 GND 0V
4,18 5mA Level 1 *Note1 3.3V down 40_GP2C2_SPI3_MISO_M0 21 22 40_GP3C5_SPDIF_TX_M1 down 3.3V Level 1 *Note1 5mA 3,21
4,17 5mA Level 1 *Note1 3.3V down 40_GP2C1_SPI3_CLK_M0 23 24 40_GP2C4_SPI_CS0_M0 down 3.3V Level 1 *Note1 5mA 2,20
0V GND 25 26 40_GP2C5_SPI2_CS1_M0 down 3.3V Level 1 *Note1 5mA 2,21
3,12 5mA Level 1 *Note1 3.3V up 2.2K up 3.3V 40_GP3B4_I2C5_SDA_M0 27 28 40_GP3B3_I2C5_SCL_M0 2.2K up 3.3V up 3.3V Level 1 *Note1 5mA 3,11
4,22 5mA Level 1 *Note1 3.3V down 40_GP4C6_SPI3_CS0_M1 29 30 GND 0V
0,22 3mA Level 0 *Note1 3.3V up 10K up 3.3V 40_GP0C6_PWM7_IR_CN 31 32 40_GP3B2_PWM9_M0 down 3.3V Level 1 *Note1 5mA 3,10
3,9 5mA Level 1 *Note1 3.3V down 40_GP3B1_PWM8_M0 33 34 GND 0V
3,4 5mA Level 1 *Note1 3.3V down 40_GP3A4_I2S3_LRCK_M0 35 36 40_GP2B3_UART1_RX_M0 up 3.3V Level 3 *Note1 15mA 2,11
2,12 15mA Level 3 *Note1 3.3V up 40_GP2B4_UART1_TX_M0 37 38 40_GP3A6_I2S3_SDI_M0 down 3.3V Level 1 *Note1 5mA 3,6
0V GND 39 40 40_GP3A5_I2S3_SDO_M0 down 3.3V Level 1 *Note1 5mA 3,5

Note1: The following data represents the current corresponding to each drive level. GPIO Drvie strength level can be set by SW. Drive level 0 : 3mA Drive level 1 : 5mA Drive level 2 : 10mA Drive level 3 : 15mA Drive level 4 : 20mA Drive level 5 : 25mA

Note2: Total current supports 600mA on Pin1,17 for 3V3 power

Note3: Total current supports 2A share on pin 2,4 for 5V power

 

3.2.3 MRAA library for Android

  • MRAA for Java for Tinker Series (Tinker Board, Tinker Board 2, Tinker Board 3, Tinker Edge R, and Tinker Edge T) mraa_java_doc.zip

  • Android Archive file for the IO interface of 14 pins on ASUS Tinker Board 3

    mraa-2.2.1.zip

  • The apk of Mraa API for Tinker Board 3

    Tinker3_40Pin_v1.1.zip

  • Class

class constructor class constructor
Gpio Gpio(int pin_index) Pwm Pwm (int pin_index)
I2c I2c (int i2c_index) Uart Uart(int uart_index)
Spi Spi (int spi_index) Aio Aio(int adc_index)
  • Index Class

-- GPIO

Tinker Board Field Index Value
Tinker Board TINKERBOARD_PIN3 3
Tinker Board TINKERBOARD_PIN5 5
Tinker Board TINKERBOARD_PIN7 7
Tinker Board TINKERBOARD_PIN8 8
Tinker Board TINKERBOARD_PIN10 10
Tinker Board TINKERBOARD_PIN11 11
Tinker Board TINKERBOARD_PIN12 12
Tinker Board TINKERBOARD_PIN13 13
Tinker Board TINKERBOARD_PIN15 15
Tinker Board TINKERBOARD_PIN16 16
Tinker Board TINKERBOARD_PIN18 18
Tinker Board TINKERBOARD_PIN19 19
Tinker Board TINKERBOARD_PIN21 21
Tinker Board TINKERBOARD_PIN22 22
Tinker Board TINKERBOARD_PIN23 23
Tinker Board TINKERBOARD_PIN24 24
Tinker Board TINKERBOARD_PIN26 26
Tinker Board TINKERBOARD_PIN27 27
Tinker Board TINKERBOARD_PIN28 28
Tinker Board TINKERBOARD_PIN29 29
Tinker Board TINKERBOARD_PIN31 31
Tinker Board TINKERBOARD_PIN32 32
Tinker Board TINKERBOARD_PIN33 33
Tinker Board TINKERBOARD_PIN35 35
Tinker Board TINKERBOARD_PIN36 36
Tinker Board TINKERBOARD_PIN37 37
Tinker Board TINKERBOARD_PIN38 38
Tinker Board TINKERBOARD_PIN40 40

-- I2C

TinkerBoard3I2C Field Index Value The Uart Interface
TinkerBoard3I2C TINKERBOARD_3_I2C1 0 I2c1
TinkerBoard3I2C TINKERBOARD_3_I2C5 1 I2c5

-- SPI

TinkerBoard3SPI Field Index Value The Uart Interface
TinkerBoard3SPI TINKERBOARD_3_SPI2 0 Spi2
TinkerBoard3SPI TINKERBOARD_3_SPI3 1 Spi3

-- Uart

TinkerBoard3UART Field Index Value The Uart Interface
TinkerBoard3UART TINKERBOARD_3_UART0 0 Uart0
TinkerBoard3UART TINKERBOARD_3_UART1 1 Uart1
TinkerBoard3UART TINKERBOARD_3_UART4 2 Uart4
TinkerBoard3UART TINKERBOARD_3_UART9 3 Uart9

-- PWM

TinkerBoard3PWM Field Pin Index Value The Uart Interface
TinkerBoard3PWM TINKERBOARD_3_PWM0 1 PWM0
TinkerBoard3PWM TINKERBOARD_3_PWM1 2 PWM1
TinkerBoard3PWM TINKERBOARD_3_PWM2 3 PWM2
TinkerBoard3PWM TINKERBOARD_3_PWM5 4 PWM5
TinkerBoard3PWM TINKERBOARD_3_PWM7 5 PWM7
TinkerBoard3PWM TINKERBOARD_3_PWM8 6 PWM8
TinkerBoard3PWM TINKERBOARD_3_PWM9 7 PWM9
TinkerBoard3PWM TINKERBOARD_3_PWM12 8 PWM12
TinkerBoard3PWM TINKERBOARD_3_PWM13 9 PWM13
TinkerBoard3PWM TINKERBOARD_3_PWM14 10 PWM14
TinkerBoard3PWM TINKERBOARD_3_PWM15 11 PWM15
  • The mraa API Class for Android

-- GPIO

Methods Parameter Description Return
dir(Dir dir) Dir Set input/output Result
readDir() void Read input/output dir Dir
read() void Set input and read gpio value 0/1
write(int v) 0/1 Set output value Result

-- I2C

Methods Parameter Description Return
address(short a) 0x00-0xFF Set i2c address Result
readByte() void Read a byte data form i2c short
writeByte(short b) Mode Write a byte data to i2c Result
read(byte[] buf) byte[] Read a byte[] data form i2c read size
write(byte[] buf) byte[] Write a byte[] data to i2c Result
readReg(short a) 0x00-0xFF Read a byte data form i2c addr short
writeReg(short a, short d) 0x00-0xFF, 0x00-0xFF Write a byte data to i2c addr Result
readWordReg(short a) 0x00-0xFF Read a byte[2] data form i2c addr int
writeWordReg(short a, int d) 0x00-0xFF, 0x0000-0xFFFF Write a byte[2] data to i2c addr Result
readBytesReg(short a, byte[] b) 0x00-0xFF, byte[] Read a byte[] data form i2c addr int

-- PWM

Methods Parameter Description Return
period(float s) 0.0001 - 2.147483 Set pwm period Result
period_ms(int m) 1 - 2147 Set pwm period Result
period_us(int u) 1 - 2147483 Set pwm period Result
pulsewidth(float s) 0.0001 - 2.147483 Set pwm duty Result
pulsewidth_ms(int m) 1 - 2147 Set pwm duty Result
pulsewidth_us(int u) 1 - 2147483 Set pwm duty Result
max_period() void Get pwm max period int(us)
min_period() void Get pwm min period int(us)
read() void Get pwm period/duty 0.0 - 1.0
write(float p) 0.0 - 1.0 Set pwm period/duty percentage Result
enable(boolean e) true/false dis/enable pwm Result

-- SPI

Methods Parameter Description Return
defaultConfig() void Set mraa default config (mode0,lsb=0,bits=8) Result
mode(Spi_Mode m) void Set spi mode Result
frequency(int f) int Set spi frequency max=48000000 Result
lsbmode(boolean l) true/false Set spi lsmode Result
bitPerWord(long b) 8/16 Set spi bit_pre_word Result
writeByte(short a) 0x00-0xFF Write a byte data to spi int(recv data)
writeWord(int a) 0x0000-0xFFFF Write a byte[2] data to spi int(recv data)
write(byte[] b) byte[] Write a byte[] data to spi byte[](recv data)

-- UART

Methods Parameter Description Return
setBaudRate(long b) long Set uart baudrate max=150000000 Result
setMode(int bytesize, UartParity parity, int stopbits) int Set the transfer mode Result
setFlowcontrol(boolean xonxoff, boolean rtscts) true/false Set the flowcontrol Result
setTimeout(int read, int write, int interchar) -1 - int_max Set the timeout for read and write operations Result
setNonBlocking(boolean b) true/false Set the blocking state for write operations Result
sendBreak(int b) 0 - max_int Send a break to the device Result
flush() void Flush the outbound data Result
dataAvailable() void Check to see if data is available on the device for reading, return immediately boolean
dataAvailable(long timeout) 1 - int_max Check to see if data is available on the device for reading and time out boolean
readStr(int length) 1 - int_max Read bytes from the device into a String object String
writeStr(String s) String write bytes in String object to a device int

-- AIO

Methods Parameter Description Return
getBit() int Gets the bit value mraa is shifting the analog read to int
read() void Read a value from the AIO pin long
readFloat() void Read a value from the AIO pin and return it as a normalized float float
setBit(int bits) int Set the bit value which mraa will shift the raw reading from the ADC to Result
  • Example for 14 pin hardware interface

-- GPIO

import mraa.*;

// Test GPIO 5 hardware interface
Gpio gpio5 = new Gpio(TinkerBoard.TINKERBOARD_PIN5.swigValue());
gpio5.dir(Dir.DIR_OUT);
gpio5.write(1);

-- I2C

Enable I2C function by modify /dtoverlay/config.txt. Then, reboot the device.

  • “#intf:i2c1=off” → “intf:i2c1=on”
  • “#intf:i2c5=off” → “intf:i2c5=on”
import mraa.*;

// Test I2c5 interface
I2c i2c = new I2c(TinkerBoard3I2C.TINKERBOARD_3_I2C5.swigValue());
// Test by ADXL345 accelerometer I2c device
i2c.address((short) 0x53);
i2c.writeReg((short)0x01, (short) 0x57);
try {
    Thread.sleep(1000);
} catch (InterruptedException e) {
    e.printStackTrace();
}
i2c.address((short) 0x50);
Log.d(TAG, "i2c5 read: 0x" + Integer.toHexString(i2c.readReg((short)0x01)));

-- PWM

Enable PWMs function by modify /dtoverlay/config.txt. Then, reboot the device.

  • “#intf:pwm0=off” → “intf:pwm0=on”
  • “#intf:pwm1=off” → “intf:pwm1=on”
  • “#intf:pwm2=off” → “intf:pwm2=on”
  • “#intf:pwm5=off” → “intf:pwm5=on”
  • “#intf:pwm7=off” → “intf:pwm7=on”
  • “#intf:pwm8=off” → “intf:pwm8=on”
  • “#intf:pwm9=off” → “intf:pwm9=on”
  • “#intf:pwm12=off” → “intf:pwm12=on”
  • “#intf:pwm13=off” → “intf:pwm13=on”
  • “#intf:pwm14=off” → “intf:pwm14=on”
  • “#intf:pwm15=off” → “intf:pwm15=on”
import mraa.*;

//enable the pwm15 signal
Pwm pwm = new Pwm(TinkerBoard.TINKERBOARD_PIN6.swigValue());
pwm.period_us(20000);
pwm.write((float) 0.5);
pwm.enable(true);

// release the pwm signal
pwm.enable(false);
pwm.unexport();

-- SPI

Enable SPI function by modify /dtoverlay/config.txt. Then, reboot the device.

  • “#intf:spi2=off” → “intf:spi2=on”
  • “#intf:spi3=off” → “intf:spi3=on”
import mraa.*;

// Test Spi3 interface
Spi spi = new Spi(TinkerBoard3SPI.TINKERBOARD_3_SPI3.swigValue());
byte[] recv = spi.write(new byte[]{0x41, 0x61});
Log.d(TAG, String.format("onCreate: recv[0]=0x%x, recv[1]=0x%x", recv[0], recv[1]));

-- UART

Enable UARTs function by modify /dtoverlay/config.txt. Then, reboot the device.

  • “#intf:uart0=off” → “intf:uart0=on”
  • “#intf:uart1=off” → “intf:uart1=on”
import mraa.*;

// Test Uart0 interface
Uart uart = new Uart(TinkerBoard3UART.TINKERBOARD_3_UART0.swigValue());
uart.defaultConfig();
uart.setBaudRate(115200);
uart.writeStr("ASUS Tinker Board 3");
String read = uart.readStr(6);
Log.d(TAG, "uart read: " + read);

 

3.2.4 Sample code for Debian

  • Program with python-periphery

    python3 -m pip install python-periphery
    
  • GPIO

    • Input control example
    from periphery import GPIO
    
    # Open GPIO /dev/gpiochip0 line 11 with input direction
    gpio_in = GPIO("/dev/gpiochip0", 11, "in")
    # Open GPIO /dev/gpiochip0 line 12 with output direction
    gpio_out = GPIO("/dev/gpiochip0", 12, "out")
    
    value = gpio_in.read()
    gpio_out.write(not value)
    
    gpio_in.close()
    gpio_out.close()
    
  • PWM

    • Enable PWMs function by modify /boot/config.txt. Then, reboot the device.

      • “#intf:pwm0=off” → “intf:pwm0=on”
      • “#intf:pwm1=off” → “intf:pwm1=on”
      • “#intf:pwm2=off” → “intf:pwm2=on”
      • “#intf:pwm5=off” → “intf:pwm5=on”
      • “#intf:pwm7=off” → “intf:pwm7=on”
      • “#intf:pwm8=off” → “intf:pwm8=on”
      • “#intf:pwm9=off” → “intf:pwm9=on”
      • “#intf:pwm12=off” → “intf:pwm12=on”
      • “#intf:pwm13=off” → “intf:pwm13=on”
      • “#intf:pwm14=off” → “intf:pwm14=on”
      • “#intf:pwm15=off” → “intf:pwm15=on”
    • Example.

    from periphery import PWM
    
    # Open PWM chip 0, channel 10
    pwm = PWM(0, 10)
    
    # Set frequency to 1 kHz
    pwm.frequency = 1e3
    # Set duty cycle to 75%
    pwm.duty_cycle = 0.75
    
    pwm.enable()
    
    # Change duty cycle to 50%
    pwm.duty_cycle = 0.50
    
    pwm.close()
    
  • UART

    • Enable UARTs function by modify /boot/config.txt. Then, reboot the device.

      • “#intf:uart0=off” → “intf:uart0=on”
      • “#intf:uart1=off” → “intf:uart1=on”
      • “#intf:uart4=off” → “intf:uart4=on”
      • “#intf:uart9=off” → “intf:uart9=on”
    • Example.

    from periphery import Serial
    
    # Open /dev/ttyS0 with baudrate 115200, and defaults of 8N1, no flow control
    serial = Serial("/dev/ttyS0", 115200)
    
    serial.write(b"Hello World!")
    
    # Read up to 128 bytes with 500ms timeout
    buf = serial.read(128, 0.5)
    print(buf)
    
    serial.close()
    
  • I2C

    • Enable I2C function by modify /boot/config.txt. Then, reboot the device.

      • “#intf:i2c1=off” → “intf:i2c1=on”
      • “#intf:i2c5=off” → “intf:i2c5=on”
    • Example.

    from periphery import I2C
    
    # Open i2c-1 controller
    i2c = I2C("/dev/i2c-1")
    
    # Read byte at address 0x100 of EEPROM at 0x50
    msgs = [I2C.Message([0x01, 0x00]), I2C.Message([0x00], read=True)]
    i2c.transfer(0x50, msgs)
    print("0x100: 0x{:02x}".format(msgs[1].data[0]))
    
    i2c.close()
    
  • SPI

    • Enable SPI function by modify /boot/config.txt. Then, reboot the device.

      • “#intf:spi2=off” → “intf:spi2=on”
      • “#intf:spi3=off” → “intf:spi3=on”
    • Example.

    from periphery import SPI
    
    # Open spidev2.0 with mode 0 and max speed 1MHz
    spi = SPI("/dev/spidev2.0", 0, 1000000)
    
    data_out = [0xaa, 0xbb, 0xcc, 0xdd]
    data_in = spi.transfer(data_out)
    
    print("shifted out [0x{:02x}, 0x{:02x}, 0x{:02x}, 0x{:02x}]".format(*data_out))
    print("shifted in  [0x{:02x}, 0x{:02x}, 0x{:02x}, 0x{:02x}]".format(*data_in))
    
    spi.close()
    

 

3.2.5 How to configure GPIO as an individual function

Use the terminal and edit the config file.

After saving the edited file, reboot the device to enable new setting.

  1. The path of config file: /boot/config.txt

  2. The default configuration of 40 pins in config.txt:

    #intf:uart0=off
    #intf:uart1=off
    #intf:uart4=off
    #intf:uart9=off
    #intf:i2c1=off
    #intf:i2c5=off
    #intf:i2s3_2ch=off
    #intf:spi2=off
    #intf:spi3=off
    #intf:spdif_8ch=off
    #intf:pwm0=off
    #intf:pwm1=off
    #intf:pwm2=off
    #intf:pwm5=off
    #intf:pwm7=off
    #intf:pwm8=off
    #intf:pwm9=off
    #intf:pwm12=off
    #intf:pwm13=off
    #intf:pwm14=off
    #intf:pwm15=off
    #intf:xin32k=off
    
  3. All configuration with ‘#’ will be set as default function in original device-tree.

    a. To turn on an individual function, remove ‘#’ and set the configuration to on, for example:

    Edit #intf:uart0=off to intf:uart0=on

    b. Similarly, to turn off an individual function to GPIO, remove ‘#’ and set the configuration to off, for example:

    Edit #intf:uart0=off to intf:uart0=off

    c. If you want to set a configuration back to default function in original device-tree, add ‘#’ at the front of the configuration line.

    #intf:uart0=off