Telink B91 EVK

Build and flash

  1. Pull docker image from repository:

    $ docker pull connectedhomeip/chip-build-telink:latest
    
  2. Run docker container:

    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" connectedhomeip/chip-build-telink:latest
    

    here ${CHIP_BASE} is directory which contains CHIP repo files !!!Pay attention that OUTPUT_DIR should contains ABSOLUTE path to output dir

  3. Activate the build environment:

    $ source ./scripts/activate.sh
    
  4. In the example dir run:

    $ west build
    
  5. Flash binary:

    $ west flash --erase
    

Usage

UART

To get output from device, connect UART to following pins:

NamePin
RXPB3 (pin 17 of J34 connector)
TXPB2 (pin 16 of J34 connector)
GNDGND

Buttons

The following buttons are available on tlsr9518adk80d board:

NameFunctionDescription
Button 1Factory resetPerform factory reset to forget currently commissioned Thread network and back to uncommissioned state
Button 2NANA
Button 3Thread startCommission thread with static credentials and enables the Thread on device
Button 4Open commission windowThe button is opening commissioning window to perform commissioning over BLE

LEDs

Indicate current state of Thread network

Red LED indicates current state of Thread network. It is able to be in following states:

StateDescription
Blinks with short pulsesDevice is not commissioned to Thread, Thread is disabled
Blinks with frequent pulsesDevice is commissioned, Thread enabled. Device trying to JOIN thread network
Blinks with wide pulsesDevice commissioned and joined to thread network as CHILD

Indicate identify of device

Green LED used to identify the device. The LED starts blinking when the Identify command of the Identify cluster is received. The command's argument can be used to specify the the effect. It is able to be in following effects:

EffectDescription
Blinks (200 ms on/200 ms off)Blink (Clusters::Identify::EffectIdentifierEnum::kBlink)
Breathe (during 1000 ms)Breathe (Clusters::Identify::EffectIdentifierEnum::kBreathe)
Blinks (50 ms on/950 ms off)Okay (Clusters::Identify::EffectIdentifierEnum::kOkay)
Blinks (1000 ms on/1000 ms off)Channel Change ( Clusters::Identify::EffectIdentifierEnum::kChannelChange)
Blinks (950 ms on/50 ms off)Finish ( Clusters::Identify::EffectIdentifierEnum::kFinishEffect)
LED offStop (Clusters::Identify::EffectIdentifierEnum::kStopEffect)

CHIP tool commands

  1. Build chip-tool cli

  2. Pair with device

    ${CHIP_TOOL_DIR}/chip-tool pairing code ${NODE_ID_TO_ASSIGN} MT:D8XA0CQM00KA0648G00
    

    here:

    • ${NODE_ID_TO_ASSIGN} is the node id to assign to the ota requestor

OTA with Linux OTA Provider

OTA feature enabled by default only for ota-requestor-app example. To enable OTA feature for another Telink example:

  • set CONFIG_CHIP_OTA_REQUESTOR=y in corresponding “prj.conf” configuration file.
  • remove “boards/tlsr9518adk80d.overlay” file to enable 2MB flash storage.

After build application with enabled OTA feature, use next binary files:

  • zephyr_final.bin - main binary to flash PCB (Use 2MB PCB).
  • zephyr-ota.bin - binary for OTA Provider
  • zephyr.bin - ignore this file.
  • zephyr.signed.bin - ignore this file.

Usage of OTA:

  • Build the Linux OTA Provider

    ./scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/ota-provider-app chip_config_network_layer_ble=false
    
  • Run the Linux OTA Provider with OTA image.

    ./chip-ota-provider-app -f zephyr-ota.bin
    
  • Provision the Linux OTA Provider using chip-tool

    ./chip-tool pairing onnetwork ${OTA_PROVIDER_NODE_ID} 20202021
    

    here:

    • ${OTA_PROVIDER_NODE_ID} is the node id of Linux OTA Provider
  • Configure the ACL of the ota-provider-app to allow access

    ./chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' ${OTA_PROVIDER_NODE_ID} 0
    

    here:

    • ${OTA_PROVIDER_NODE_ID} is the node id of Linux OTA Provider
  • Use the chip-tool to announce the ota-provider-app to start the OTA process

    ./chip-tool otasoftwareupdaterequestor announce-otaprovider ${OTA_PROVIDER_NODE_ID} 0 0 0 ${DEVICE_NODE_ID} 0
    

    here:

    • ${OTA_PROVIDER_NODE_ID} is the node id of Linux OTA Provider
    • ${DEVICE_NODE_ID} is the node id of paired device

Once the transfer is complete, OTA requestor sends ApplyUpdateRequest command to OTA provider for applying the image. Device will restart on successful application of OTA image.