The Telink Temperature Measurement Example demonstrates getting simulated data from temperature sensor. In further releases the real sensor handling will be implemented along. It uses buttons to test changing the device states and LEDs to show the state of these changes. You can use this example as a reference for creating your own application.
The example supports building and running on the following devices:
Board/SoC | Build target | Zephyr Board Info |
---|---|---|
B91 TLSR9518ADK80D | tlsr9518adk80d , tlsr9518adk80d-mars , tlsr9518adk80d-usb | TLSR9518ADK80D |
B92 TLSR9528A | tlsr9528a , tlsr9528a_retention | TLSR9528A |
B95 TLSR9258A | tlsr9258a | TLSR9258A |
W91 TLSR9118BDK40D | tlsr9118bdk40d | TLSR9118BDK40D |
Run the Docker container:
$ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
You can find the compatible Docker image version in the file:
$ .github/workflows/examples-telink.yaml
Activate the build environment:
$ source ./scripts/activate.sh -p all,telink
Build the example (replace <build_target> with your board name, see Supported devices):
$ west build -b <build_target>
Also use key -DFLASH_SIZE
, if your board has memory size different from 2 MB, for example, -DFLASH_SIZE=1m
or -DFLASH_SIZE=4m
:
$ west build -b <build_target> -- -DFLASH_SIZE=4m
You can find the target built file called zephyr.bin under the build/zephyr directory.
Flash binary:
$ west flash --erase
To get output from device, connect UART to following pins:
Name | Pin |
---|---|
RX | PB3 (pin 17 of J34 connector) |
TX | PB2 (pin 16 of J34 connector) |
GND | GND |
Baud rate: 115200 bits/s
The following buttons are available on tlsr9518adk80d board:
Name | Function | Description |
---|---|---|
Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) |
Button 2 | NA | NA |
Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device |
Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE |
Red LED indicates current state of Thread network. It is able to be in following states:
State | Description |
---|---|
Blinks with short pulses | Device is not commissioned to Thread, Thread is disabled |
Blinks with frequent pulses | Device is commissioned, Thread enabled. Device trying to JOIN thread network |
Blinks with wide pulses | Device commissioned and joined to thread network as CHILD |
Build chip-tool cli
Pair with device
${CHIP_TOOL_DIR}/chip-tool pairing ble-thread ${NODE_ID} hex:${DATASET} ${PIN_CODE} ${DISCRIMINATOR}
Example:
./chip-tool pairing ble-thread 1234 hex:0e080000000000010000000300000f35060004001fffe0020811111111222222220708fd61f77bd3df233e051000112233445566778899aabbccddeeff030e4f70656e54687265616444656d6f010212340410445f2b5ca6f2a93a55ce570a70efeecb0c0402a0fff8 20202021 3840
OTA feature enabled by default only for ota-requestor-app example. To enable OTA feature for another Telink example:
After build application with enabled OTA feature, use next binary files:
All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have higher SW version than base SW. Set CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=2 in corresponding “prj.conf” configuration 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:
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:
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:
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.