shimmeringbee / zstack

Implementation of a ZNP and support code designed to interface with Texas Instruments Z-Stack, written in Go.

Home Page:https://shimmeringbee.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support CC2652 adapter

pwood opened this issue · comments

Add support for CC2652 based adapters, these use firmware from Koenkk which is based on Z-Stack 3.X.0, because this supporst Zigbee 3.0 there are some differences to the initialisation of the adapter. To do this, we will need to:

  • Query the version of the adapter with SYS_VERSION, alternatively it's also returned in SYS_RESET_IND.

CC2531

(*zstack.SysResetInd)(0xc00000b8f0)({
 Reason: (zstack.ResetReason) 0,
 TransportRevision: (uint8) 2,
 ProductID: (uint8) 0,
 MajorRelease: (uint8) 2,
 MinorRelease: (uint8) 6,
 HardwareRevision: (uint8) 3
})

CC2653

(*zstack.SysResetInd)(0xc000204008)({
 Reason: (zstack.ResetReason) 0,
 TransportRevision: (uint8) 2,
 ProductID: (uint8) 1,
 MajorRelease: (uint8) 2,
 MinorRelease: (uint8) 7,
 HardwareRevision: (uint8) 1
})

zStack 1.2.0 is indicated by 0, 3.x.0 is indiciated by 1 and 3.0.x is indiciated by 2. (No not a typo).

Based upon the SysResetInd.ProductID we can switch initialisation behaviour, if the device does not return a valid version, then assume CC2531 behaviour.

  • If > 1.2.0, when verifying if the network configuration is correct, if the PANID reads as 0xffff, then it is not a failure.
  • If == 3.x.0, then reading the network key uses a different call.
  • If > 1.2.0, during initialisation:
    • the trust centre key does not need to be written (already valid)
    • writing network key is done different.
    • the base device behaviour system must be initialised, with the channel, wait for start, then start comissioning.

Zigbee herdsman implementation can be found here: https://github.com/Koenkk/zigbee-herdsman/blob/master/src/adapter/z-stack/adapter/startZnp.ts