Friday 22 February 2019

Elbert: CC26x2 Launchpad + XBee 802.15.4 integration

TI CC26x2 Launchpad (CC2652R1) as end node of a Digi Xbee 802.15.4 coordinator
The first tests for integrating a TI CC26x2 Launchpad as 802.15.4 end node in a PAN coordinated by a Digi Xbee Pro S1 module have been performed with relative successful results: Though the integration is feasible, there are still some stability issues that must be solved.

The tests have been performed taking as base the TI CC26x2 SDK 802.15.4 "sensor" example program, that implements an end-node able to join to a coordinator and send periodically temperature samples (among other data). On the original code, these changes have been performed:
  • Application/2_4g/config.h: macro CONFIG_SECURE set to false to disable network encryption
  • Application/2_4g/config.h: macro CONFIG_PAN_ID set to 0x0001 to match the PAN id set on the Coordinator side (Xbee ID parameter)
  • Application/2_4g/config.h: macro CONFIG_CHANNEL_MASK bytes 1 & 2 (first byte is byte 0) set to 0xF0 and 0xFF to allow end node using all the channels in which the Xbee Pro module can work (from channel 12, or 0x0C, to channel 23, or 0x17). Note however that this channel usage must match the channels enabled on the Xbee coordinator side (parameter SC)
In the other side, a Xbee Pro S1 module with firmware 10EF (last version available) performs the tasks of PAN coordinator, both being installed on a Connectport X2 with the radio forwarded to a serial port or on a XBIB-U-DEV board. The relevant parameters modified in the Xbee module are:
  • Coordinator association (A2) mask set to 0x6, indicating that the coordinator will establish the network in the best of the enabled channels (read on) and that the coordinator allows association of end nodes
  • Coordinator enable (CE) set to 1: Module working as coordinator
  • Encryption enable (EE) set to 0: Encryption disabled
  • Mac Mode (MM) set to 2: Module working on legacy 802.15.4 with ACKs enabled
  • Network address (MY) set to 0: The coordinator address will be the address 0
  • PAN identifier (ID) set to 0x0001
  • Scan channels (SC) set to 0x1FFE, meaning that the coordinator will try to establish the network only on all the XBee Pro available channels (from channel 0x0C, or 12, to channel 0x17, or 23).
With these settings, the CC26x2 joins as end node to the PAN created by the Xbee coordinator and a third party is able to receive the temperature data sent by the CC26x2 via the coordinator. Some issues have to be considered, though:
  • It is highly recommended to open a Monitor session to the CC26x2 serial port (on Code Composer Studio, via the JTAG interface) to know exactly what is happening on it. The network changes are reported using these numeric codes:
    • 0: Module not started, waiting for user to start
    • 1: Module trying to join to a network
    • 2: After a reboot, the module has found network information on non-volatile memory and it is trying to join the network it was joined before the reboot
    • 3: Module successfully joined to a network
    • 4: Module successfully rejoined to a network
    • 5: Module has lost the network and right now is orphan
  • The CC26x2 will always try to rejoin a previously known network. To avoid it, it is necessary rebooting erasing the non-volatile memory by holding button 2, then pressing and releasing the reset button, then releasing button 2.
  • If the CC26x2 channel mask is broad, ie, if it has to search a coordinator in many channels, it is possible that the joining was not instantaneous after rebooting: Finding the coordinator channel will take some time (in the order of tens of seconds).
  • If the Xbee module serial port is not open, the module locks after receiving 3-5 frames from the CC26x2. It is the explanation to the fact that, if the Xbee module is set on the XBIB-U-DEV board just powered, but with the USB port not mapped in the computer side, it becomes locked. However it does not happen if the same board is connected to a computer that maps the USB port.
  • Even being joined, the X2 coordinator does not show the CC26x2 in the list of detected devices. It is possible that only Xbee devices were shown in that list, with information obtained from the Digi extra header added to the 802.15.4 header when the Xbee MM parameters is set to 1 (that is not this case).
At this point it has been confirmed that the connection is feasible. However some stability issues must be investigated:
  • In some circumstances, the CC26x2 is not able to find the coordinator network. This usually happens after resetting/reflashing the CC26x2, with the module staying in state 1 (trying to join) permanently. It is necessary to check if, in these circumstances, a reset with nvmem erase (by holding button 2, as explained before) solves the problem.
  • In some circumstances, the CC26x2 joins the network and sends samples, but the coordinator is unable to receive data: Neither data is output in X2 gateway mode, nor the X2 counters increment in non-gateway mode, nor the radio signal strength leds in XBIB or X2 show activity.