Heads up! New Developer Preview programs are rolling out soon. Apply here and be one of the first to try new tools and provide feedback.

Telink

TLSR9518

This example functions as a light bulb device type, with on/off capabilities. The steps were verified on a Telink TLSR9518 development board (also known as the B91 Development Board).

This example uses a test Vendor ID (VID) of 0xFFF1 and a Product ID (PID) of 0x8005.

Top view of the TLSR9518

Initial setup

The steps in this document were validated on Ubuntu 20.04.

  1. Connect the dev board to the host PC with a USB-to-UART adapter for the serial console:

    • Connect PB2 of J34 (labeled TX above) on the dev board to RXD of the adapter.
    • Connect GND of J56 (labeled GND above) to GND of the adapter.
  2. Connect one side of the Burning Key (the black box with four LEDs) to the host PC with a USB A Male-to-Mini B cable, and the other side to the dev board with another USB A Male-to-Mini B cable as following:

    Connecting the TLSR9518

  3. Download LinuxBDT:

    wget http://wiki.telink-semi.cn/tools_and_sdk/Tools/BDT/LinuxBDT.tar.bz2
    tar -xvf LinuxBDT.tar.bz2
    
  4. Install Docker Engine (don't use Docker Desktop).

  5. Run the Docker container (this will take a while to complete the first time):

    docker run -it --rm -v $PWD:/host -w /host connectedhomeip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/v1.0-branch/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
    
  6. In the Docker container, clone and initialize the Matter SDK github repository ( connectedhomeip ):

    git clone https://github.com/project-chip/connectedhomeip.git
    cd connectedhomeip
    git fetch origin v1.0-branch
    git checkout FETCH_HEAD
    ./scripts/checkout_submodules.py --platform telink
    source ./scripts/activate.sh
    

Build the image and flash the board

  1. In the Docker container, build the lighting-app , and then exit from Docker:

    cd examples/lighting-app/telink
    rm -rf build
    west build
    exit
    
  2. Flash the image to the board:

    cd LinuxBDT
    sudo ./bdt 9518 sws # Verify the connection
    sudo ./bdt 9518 ac # Activate MCU
    sudo ./bdt 9518 wf 0 -s 2040k -e # Erase flash sectors
    sudo ./bdt 9518 wf 0 -i ../connectedhomeip/examples/lighting-app/telink/build/zephyr/zephyr.bin
    sudo ./bdt 9518 rst -f # Reset MCU
    

    If the previous steps succeeded, the following commands should produce similar output in the terminal:

    sudo ./bdt 9518 sws
     TC32 EVK: Swire ok!
    sudo ./bdt 9518 ac
    Activate OK!
    sudo ./bdt 9518 wf 0 -s 2040k -e
    EraseSectorsize...
    Total Time: 26973 ms
    sudo ./bdt 9518 wf 0 -i ../connectedhomeip/examples/lighting-app/telink/build/zephyr/zephyr.bin
    EraseSectorsize...
    Total Time: 9806 ms
    Flash writing...
    [ 0%]Flash Bytes Program at address 0
    ...
    [100%]Flash Bytes Program at address b6d00
    File Download to Flash at address 0x000000: 748836 bytes
    Total Time: 191337 ms
    sudo ./bdt 9518 rst -f
    Total Time: 72 ms
    reset mcu

Validate the example

  1. The device should present itself as a USB serial device on your computer. You may look it up in /dev:

    ls -la /dev/tty*
    

    You can open the serial console with GNU screen or minicom. For example, if the device is at /dev/ttyACM0:

    screen /dev/ttyACM0 115200
    
  2. To reset the board, press the CHIP_RESET button, and you should see output like this in the terminal:

    *** Booting Zephyr OS build v3.1.0-rc1-3593-gdac17979d626  ***
    I: Init CHIP stack
    I: Starting CHIP task
    ...
    I: 812 [DL]BLEManagerImpl::ConfigureAdvertisingData
    I: 823 [DL]Setting device name to : "TelinkMatter"
    ...
    I: 1093 [SVR]SetupQRCode: [MT:NOTAREALQRCODE01234]
    I: 1099 [SVR]Copy/paste the below URL in a browser to see the QR Code:
    I: 1107 [SVR]https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT%3ANOTAREALQRCODE01234
    I: 1118 [SVR]Manual pairing code: [34970112332]
    I: 1124 [DL]Setting device name to : "TelinkLight"
    
  3. After successfully commissioning the board, you may control the blue LED by pressing the SW3 K2 button. Each press causes the LED to alternately turn on or off and the following output to appear in the terminal:

    I: Turn On Action has been initiated
    I: Turn On Action has been completed
    D: 1058359 [DMG]Endpoint 1, Cluster 0x0000_0006 update version to 92b92035
    ...
    I: 1058365 [ZCL]Cluster OnOff: attribute OnOff set to 1
    ...
    D: 1058372 [DMG]Endpoint 1, Cluster 0x0000_0008 update version to 7ea4bc9c
    ...
    I: 1058378 [ZCL]Cluster LevelControl: attribute CurrentLevel set to 254
    
  4. To factory reset the board, press the SW2 K1 button, and you should see output like this in the terminal:

    I: Factory Reset triggered.
    

Next steps

When your Matter example has been successfully built, create a developer project.