• Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language
    C
  • License
    Other
  • Created about 1 year ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Custom firmware for Zigbee 3.0 IoT devices on the TLSR825x chip

Custom firmware for Zigbee 3.0 IoT devices on the TLSR825x chip

Based on an example from Telink's Zigbee SDK.

Currently supported devices: LYWSD03MMC, CGDK2, MHO-C122, MHO-C401N, TS0201_TZ3000

Please direct questions regarding use and configuration in ZHA, Zigbee2MQTT, Home Assistant to the appropriate resources.

In developing: MHO-C401(old), MJWSD05MMC, CGG1-M, TS0202_TZ3000

Firmware readiness level - Beta versions 0.1.x.x. Stable from version 0.1.1.0, but additional tests are required

  • Due to high consumption, limited transmit power of +2 dBm is used. A moderately discharged CR2032 battery cannot withstand higher power.

Tests, validation and options are required with solution descriptions to support users with Zigbee features in Home Assistant:

  1. Touchlink commissioning
  2. ZCL_GROUP

To flash the Zigbee firmware, use a Google Chrome, Microsoft Edge or Opera Browser.*

  1. Go to the Over-the-air Webupdater Page TelinkMiFlasher.html
  2. If using Android, Windows, Linux: Ensure you enabled "experimental web platform features". Therefore copy the according link (i.e. chrome://flags/#enable-experimental-web-platform-features for Chrome), open a new browser tab, paste the copied URL. Now sten the Experimental Web Platform features flag to Enabled. Then restart the browser.
  3. In the Telink Flasher Page: Press Connect:. The browser should open a popup with visible Bluetooth devices. Choose the according target device (i.e. LYWSD03MMC) to pair.
  4. After connection is established a Do Acivation button appears. Press this button to start the decryption key process.
  5. Now you can press the Zigbee Firmware button to directly flash the Zigbee Firmware:
    Alternatively you can choose a specific firmware binary (i.e. the original firmware) via the file chooser. Example: in the file name field paste "https://github.com/devbis/z03mmc/releases/download/1.0.6/1141-0203-10063001-z03mmc.zigbee". If the firmware file is larger than 128 kilobytes, then you will have to download BLE version 4.6 or later. BLE versions below 4.6 do not support OTA downloads with fw sizes larger than 128 kilobytes. Xiaomi firmwares, excluding MJWSD05MMC, also do not support OTA downloads with fw sizes larger than 128 kilobytes.
  6. Press Start Flashing. Wait for the firmware to finish.
  7. The device should now show up in your Zigbee bridge (If joining is enabled, of course). If this does not happen, reinsert the battery and/or short-circuit the RESET and GND pins on the LYWSD03MMC board, and on sensors with a button, press the button and hold it for 7..8 seconds.

Action of the button

Action of the button (or contact "reset" to "gnd" for LYWSD03MMC):

  • Short press - send temperature, humidity and battery data.

  • Hold for 2 seconds - Switches temperature between Celsius and Fahrenheit. The change will immediately appear on the screen.

  • Hold for 7 seconds - reset the binding and restart. The screen will briefly display “---” (for devices using a screen with fast refresh capabilities, not E-Ink). After restarting, the thermometer will wait forever for registration. Jerking the battery won't change anything.

  • After flashing from BLE, the thermometer is already in standby mode for registration in the Zigbee network.

Zigbee OTA

OTA update in ZHA

Before flashing the firmware, check the compliance of the “Manufacturer Code” and “Image Type” between the OTA file and those issued by the Zigbee device.

Sample: "1141-020a-01233001-Z03MMC.zigbee"

Manufacturer Code Image Type File Version Stack Version Name Ext OTA
1141 020a 0123 3001 Z03MMC zigbee
0x1141 - Telink 0x02 - TLSR825x, 0x0a - Xiaomi LYWSD03MMC App release 0.1, App build 2.3 Zigbee v3.0, Release 0.1 Z03MMC OTA
Image Type Device, note
0x0201 MHO-C401 (old version)
0x0202 CGG1 (old version)
0x0203 LYWSD03MMC ver https://github.com/devbis/z03mmc
0x0204 WATERMETER ver https://github.com/slacky1965/watermeter_zed
0x0206 CGDK2
0x0207 CGG1 (new version)
0x0208 MHO-C401 (new version)
0x0209 MJWSD05MMC
0x020A LYWSD03MMC ver https://github.com/pvvx/ZigbeeTLc
0x020B MHO-C122
0x0210 Water Tank sensors (not published)
0x0211 TS0201-TZ3000
0x0212 TS0202-TZ3000

Display decimal places for temperature, humidity and battery charge in ZHA.

ZHA patch for more precision display of data for all Zigbee devices.

Indication on LCD screen

A solid "BT" icon indicates a connection loss or the thermometer is not registered with the Zigbee network.

The flashing "BT" icon is called by the "identify" command.

ZHA: Switch temperature between Celsius and Fahrenheit, Show smiley, Comfort parameters

Setting offsets for temperature and humidity.

ZHA: Setting offsets for temperature and humidity

Current additions

  1. Added project assembly using 'make' (Windows/linux) and the ability to import 'Existing Project' into "Telink IoT Studio".

  2. Default intervals for temperature and humidity reporting are set to 30-120 (min-max) seconds, reportableChanged to 0.1C and 0.5%.

  3. Consumption has been optimized when the coordinator is disconnected or connection is lost. When performing rejoin, if the connection is broken, the thermometer consumes quite a lot. Monitor the work of your network coordinator - Zigbee does not like (almost cannot tolerate) coordinator outages.

  4. Consumption has been optimized when polling the reset button or contact.

  5. Additional adjustments to consumption consumption and correction of the report transmission functions algorithm.

  6. Correspondence of transmitted and displayed measurements (correct rounding).

  7. Reducing firmware size: removing unnecessary code from SDK, reorganization of battery voltage measurement (ADC), ...

  8. Averaging battery level measurements (eliminates clutter on charts)

  9. Switch temperature between Celsius and Fahrenheit

  10. Adding button actions (ver 0.1.1.1)

  11. Added Poll Control Cluster (ver 0.1.1.2)

  12. Ver 0.1.1.4: According to the "ZigBee Cluster Library Specification" the "Thermostat Temperature Conversion" values have been corrected. Added On/Off smiley. (ClusterID: 0x0204 (Thermostat User Interface Configuration), Attr: 0x0000 (TemperatureDisplayMode), ENUM8 = 0 in C, = 1 in F, Attr: 0x0002 (ScheduleProgrammingVisibility), ENUM8 = 0 show smiley On, = 1 show smiley Off)

  13. Ver 0.1.1.5: Description of the HVAC cluster (for ZHA)

  14. Ver 0.1.1.6: Setting offsets for temperature and humidity.

  15. Ver 0.1.1.7: Add Comfort parameters

  16. Ver 0.1.1.8: Easy version. Options disabled: "Groups", "TouchLink", "Find and Bind".

  17. Ver 0.1.1.9: Fix configuration saving error

Make

To build under Linux, run:

git clone https://github.com/pvvx/ZigbeeTLc
make install
make

Out log:

===================================================================
 Section|          Description| Start (hex)|   End (hex)|Used space
-------------------------------------------------------------------
 ramcode|   Resident Code SRAM|           0|        1360|    4960
    text|           Code Flash|        1360|       1E028|  117960
  rodata| Read Only Data Flash|           0|           0|       0
 cusdata|          Custom SRAM|      844FD8|      844FD8|       0
      nc|   Wasteful Area SRAM|      841360|      841400|     160
   ictag|     Cache Table SRAM|      841400|      841500|     256
  icdata|      Cache Data SRAM|      841500|      841D00|    2048
    data|       Init Data SRAM|      841D00|      841E94|     404
     bss|        BSS Data SRAM|      841EA0|      844FD8|   12600
 irq_stk|        BSS Data SRAM|      841EA0|      8420A0|     512
    cbss| Custom BSS Data SRAM|      844FD8|      844FD8|       0
   stack|       CPU Stack SRAM|      844FD8|      850000|   45096
   flash|       Bin Size Flash|           0|       1E1BC|  123324
-------------------------------------------------------------------
Start Load SRAM : 0 (ICtag: 0x0)
Total Used SRAM : 20440 from 65536
Total Free SRAM : 160 + stack[45096] = 45256

Under Window, after downloading the project, run “make install”:

git clone https://github.com/pvvx/ZigbeeTLc
make install

and import the project into 'Telink IoT Studio' as described in 'Telink_IoT_Studio_User_Guide.pdf', chapter "6 Import and build projects".

On Windows, it is possible to enable multi-threaded assembly to build the entire project from scratch in 2..3 seconds (make -j -> 3 seconds on 12 cores/24 threads).


The start of the project with Zigbee on TLSR825x was inspired by the following original works:



More Repositories

1

esp8266web

Small web server on ESP8266
C
236
star
2

SDKnoWiFi

ESP8266 Open SDK without WiFi (startup < 30 ms to complete the flash cache)
C
110
star
3

MinEspSDKLib

Minimalist SDK on ESP8266ex
C
108
star
4

RtlDuino

Arduino module RTL8195/8711/8710Ax
C
72
star
5

mp3_decode

Test ESP8266 MP3 webradio (512k Flash)
C
62
star
6

TlsrTools

Alternative programmer for TLSR8269
C
46
star
7

TlsrComSwireWriter

TLSR826x/825x COM port Swire Writer
Python
37
star
8

TlsrComProg

TLSR826x programmator via COM port
C
30
star
9

RTL00MP3

RTL00(RTL8710AF) Test MP3
C
29
star
10

STM32INA2xxPowerProfiler

STM32/BLE INA219/INA226 Power Profiler
C
27
star
11

pvvx.github.io

web data
HTML
26
star
12

TLSRPGM

TLSR SWire programmer
C
26
star
13

UBIA

USB/BLE to I2C/ADC Adapter
C
25
star
14

EspLua

A lua based firmware for wifi-soc esp8266
C
17
star
15

Rapid_Loader

ESP8266 Rapid Loader
C
14
star
16

BZdevice

Custom firmware for devices on the TLSR825x chip operating simultaneously in Zigbee 3 and Bluetooth LE
C
11
star
17

AdScanerTrg

TLSR8266/825x AdScanerTrg - relay control from external BLE sensors for temperature, humidity, lighting, motion, reed switch. A repeater of BLE advertising packages.
C
10
star
18

TlsrComProg825x

TLSR825x programmator via COM port
C
10
star
19

BLE_THSensor

BLE temperature and humidity sensor based on TS0201
C
9
star
20

RTL871x_Info

9
star
21

TLSR8269-EVK

EVK on the E104-BT10-G/N module (TLSR8269).
9
star
22

RTL00_WEB

Simple web server for RTL8710AF
C
7
star
23

SimplePowerProfiler

Simple PowerProfiler on INA219/226/3221...
C
6
star
24

ADV_BLE2UART

Receiving BLE advertisements via UART.
C
6
star
25

TlsrTools825x

Alternative programmer for TLSR825x
C
5
star
26

RTL00_HelloWorld

C
5
star
27

Zigbee2BLE

Gateway Zigbee in BLE on modules with TLSR825x.
C
4
star
28

rtl00TstMinAmebaV35a

RTL00 (RTL8710AF) Test Minimal AmebaV3.5a GCC
C
4
star
29

TLSR825x_OTA_Flash_Hacker

Allows: read firmware via BLE, restore and patch the original firmware, ...
C
4
star
30

PHY62x2

PHY62x2
Python
3
star
31

RTL0B_SDK

RTL8710BN SDK
C
3
star
32

RTL0B_WEB

RTL series "B", Small Web Server
C
3
star
33

RTL00ConsoleROM

Test RTL Console ROM
C
2
star
34

PowerProfiler_pcm1802

Using an AUDIO chip as a 24-bit ADC
C
2
star
35

hcitooladv

BLE Advertising monitor
C
2
star
36

RTL00_AT

RTL00(RTL8710AF) AT command
C
2
star
37

RTLHTTPD

C
1
star
38

bl702_adc_test

USB ADC 16 bits (averaging) test BL702
C
1
star
39

JieLiAC690XSDK

JieLi-AC690X
C
1
star