Thursday, 7 January 2021

Montana: Granite Software resources installed

In order to develop the Montana Granite Litems, a set of software resources are needed. Specifically, for developing the source code for the Arduino Nano 33 IoT, this software has been installed:

  1. Arduino IDE for Mac in its latest version (1.8.13)
  2. Support for Arduino SAMD Boards (32-bits ARM Cortex-M0+) in its latest version (1.8.11)
  3. ArduinoBLE library in its latest version (1.1.2)
Since, from a Bluetooth BLE perspective, the Litem is being supporting the role of GATT server, a GATT client is necessary to exchange data. In real world that client will be the Montana Yellowstone gateway, but in order to decouple litem and gateway developments a basic GATT client will be developed in the  Montana Granite project with the purpose of validating results.

The Granite GATT client will be developed in C# running on .NET Core Framework. For that purpose a VirtualBox Linux host with Ubuntu 20.04 Minimal Desktop distro has been deployed, and this software has been installed:
  1. packages-microsoft-prod.deb package, that adds Microsoft software repositories as packages sources
  2. dotnet-sdk-5.0 package
  3. Visual Studio Code for Linux in its latest version (1.52.1) via snap (sudo snap install --classic code)
  4. C# Visual Studio Code extension
  5. git package
  6. nuget package
BlueZ, the Linux Bluetooth protocol stack, was included in the Ubuntu distro.

Tuesday, 5 January 2021

Montana: Arduino Nano33 IoT selected for Granite project

In order to develop the Montana Granite project, ie, a Litem based on Bluetooth Low Energy communication, a state-of-the-art in technology have been done. Through all the available modules in the market, two seemed the more promising:

Though the first one offered more flash to a lower price, the second one has been chosen by evaluating positively the stability and support of the Arduino products. Moreover, the Nano 33 is slightly smaller than the Expressif board.

A Nano 33 IoT board has been bought, the Arduino IDE has been installed and support to Microchip SAMD based boards has been added as explained here (specifically, the Nano 33 IoT board is based on a Microchip SAMD 21 SoC). 

The board pinout is similar to the previous Nano boards as can be checked here. A good getting-started project, based on the ArduinoBLE library, can be checked here. Lastly, though the BLE UUIDs should be defined as private, the list of assigned UUIDs can be checked here.

Montana projects started

A new branch in the project repository addressed to develop two new subprojects has been created. The new subprojects are:

  • Litem (Mount) Granite project, addressed to develop a set of Litems based on Bluetooth Low Energy (BLE) devices, specifically on Arduino Nano 33 devices. The code is located in the subdirectory SteamProject/software/litems/ble/arduino-nano33/granite of the GitHub repository (direct access clicking here).
  • Gateway Yellowstone (river) project, addressed to develop a gateway developed on .NET Core using BLE as communication channel. The code is located in the subdirectory SteamProject/software/gateways/dotnet/yellowstone/ of the GitHub repository (direct access clicking here). Yellowstone project is intended to be developed in C#.

Tuesday, 11 February 2020

Setting the MAC address on a Texas Instrumens CC26x2

The MAC address of the TI CC2652 can be set as factory configuration or as customer configuration.

In the first case, and as stated in the CC26xx memory map, the address value is stored in the Factory Configuration Area (FCFG1), specifically in the registers MAC_15_4_0 and MAC_15_4_1, corresponding to the addresses  0x500012F0 (address offset 0x02F0) and 0x500012F4 (address offset 0x02F4).

In the second case (address set as customer configuration) the values are stored in the Customer Configuration Area (CCFG), specifically in the registers IEEE_MAC_0 and IEEE_MAC_1, corresponding to the addreses 0x50004FC8 (address offset 0x1FC8) and 0x50004FCC (address offset 0x1FCC).

Though in both cases the values stored in these addresses are read-only at runtime, the values stored in the Customer Configuration Area can be set in the firmware source code. By default, the CCFG IEEE_MAC_0 and IEEE_MAC_1 address values are defined in the Core SDK driverlib startup_files/ccfg.c file, and therefore set for all the developed applications through the macros SET_CCFG_IEEE_MAC_0 and SET_CCFG_IEEE_MAC_1, both set by default to 0xFFFFFFFF.

As the CCFG documentation states, in case of being set to 0xFFFFFFFF, the IEEE_MAC_0 and IEEE_MAC_1 values must be considered invalid and the FCFG1 MAC_15_4_0 and MAC_15_4_1 values must be used. In practice that means that if the user is not setting an specific MAC address, the default, factory MAC address will be used. This behaviour is coded in the main.c of most (fi not all) SDK examples.

Then, how the user can set the MAC address to an specific, user value? To do that, the macros SET_CCFG_IEEE_MAC_0 and SET_CCFG_IEEE_MAC_1 must be re-defined in the application-specific ccfg.c file. This file is empty by default and its purpose is, specifically, redefining CCFG macros with custom-user values. Specifically, SET_CCFG_IEEE_MAC_0 contains bits 31 to 0 of the MAC, whereas SET_CCFG_IEEE_MAC_1 contains bits 63 to 32.

Have in mind that the CCFG area will be only flashed if, apart of stating specific values as previously explained, the debugger flash settings are set to rewrite (not to keep) it. To proceed in that way uncheck the CCFG protection as shown in the image below. Have in mind that, once the user address was writen in CCFG, it is not necessary rewriting it every time the program changes, unless the whole address changed.


Last but not least, it is very important to consider that, in case of defining a user-specific MAC address, it must be considered as local (not universal) and therefore the second-least-significant-bit of the first octet must be set to 1. That means that the least significat byte of SET_CCFG_IEEE_MAC_0 must have its second bit set to 1 (for instance being set to 0x00000002).

If a Texas Instruments reserved universal MAC address is being used (converting it to local according to that explained in the previous paragraph), a list of the TI vendor-specific three first octects can be checked here. Notice that, since they are universal and not local, all the shown values have the second bit of the least significant byte set to 0.

As an example, if the reserved 0xFC0F4B universal address prefix is being used, first it must be converted from universal to local by setting to 1 the second bit of the least significant byte. In that way, the prevouls value would be converted to 0xFE0F4B. Taking it as base, a valid, local MAC address would be FE:0F:4B:00:00:00:00:01. Therefore, the SET_CCFG_IEEE_MAC_0 macro would be set to 0x004B0FFE and SET_CCFG_IEEE_MAC_1 would be set to 0x01000000.

Monday, 4 March 2019

Colorado: Accessing to 802.15.4 networks from Raspberry Pi. Software

Raspberry Pi + Digi Xbee + Java integration
This document defines the procedure, from a software perspective, for accesing to a 802.15.4 network from a Raspberry Pi using a Digi Xbee module. This document completes the analogue document defining the procedure from a hardware perspective.

Once successfully completed the hardware integration between a  Raspberry Pi B+ board and a Digi XBee S1 Pro 802.15.4 module, it is necessary to perform some actions addressed to allow the software running on the RPi to access the 802.15.4 network. Since the XBee module is running as PAN coordinator, some of the actions must be addressed to support this additional requirement.

As said in the hardware document, the RPi has a serial port suitable to be used for creating a TTL-level connection with the Xbee module. In the Raspberry versions prior to version 3, this port was /dev/ttyAMA0, however when Bluetooth functions were added the AMA0 was used for Bluetooth and the simpler and more troublesome mini-uart was in charge of the serial connections. So in case of having a RPi 3 and wanting to switch back to the AMA0 serial port (very recommended), it is necessary to edit the /boot/config.txt file and add a new line with the directive dtoverlay=pi3-miniuart-bt.

Another potential problem present in the RPi regarding the usage of the serial ports is the fact that the Linux kernel is configured by default to attach a console to /dev/ttyAMA0. That means that, when booting, the kernel will write to the serial port what could set (and actually does) the Xbee module in a unstable status. To avoid the kernel using the serial port, edit the file /boot/cmdline.txt, that contains the argument list passed to the kernel, and remove the argument console=serial0,115200 or console=ttyAMA0,155200. Take special care in just removing that argument and its preceding or traling space to keep the agument list format coherent.

At this point the RPi is ready to use the XBee module connected to its /dev/ttyAMA0 serial port. To do that from a software point of view, the chosen approach is developing Java code due to several reasons:
  • Java is supported by Raspbian, specifically the JDK8. To install it, run sudo apt-get install oracle-java8-jdk.
  • You can access the serial port from Java using, among other options, the RxTx library. To install it, run sudo apt-get install librxtx-java.
  • You can access the GPIO input/outputs from Java by using the Pi4J library. Specifically, you can use a GPIO output to hard-reset the Digi module, a very interesting option when even the soft reset fails (and it does). To know more about how to control de GPIOs check this example, and to know how to install Pi4J, click here. How to reset the XBee from a RPi GPIO output will be covered in future documents.
Last but not least, you can programatically interface with Digi XBee devices by using the Digi XBee Java Library, whose source code and binaries are available on GitHub and whose complete documention is available on the Digi site. This library offers a high level interface for managing the XBee modules, both as 802.15.4 end points or coordinators. At least up to the last available release (1.2.1) this library relies on the Java RxTx library for accessing the serial port, so it is necessary to install it to allow the library run (see the previous notes about how to install the RxTx library).

First test

Once the XBee Java library is installed on a development computer (that can or cannot be the RPi), a good starting point is following the “Building your first XBee Java application” tutorial described in the library documentation, and doing it taking as base the ReceiveDataSample example contained in the examples/communication subdirectory. This example writes in the standard output all the data (in hex and ASCII format) received from any 802.15.4 end node. To properly run this example, it is necessary to follow these steps once the project has been successfully loaded in the development environment (Eclipse, Netbeans, ...):
  1. Modify the values of the variables PORT and BAUD_RATE declared in the main function, that store the name of the serial port (set PORT to “/dev/ttyAMA0”) and baud rate (set BAUD_RATE to 115200) used to connect to the XBee module.
  2. After successfully building the project, copy the contents of the project subdirectory dist (in Netbeans, the subdirectory where the binaries and libraries are stored after building) to a directory in the RPi (for this example we will assume that it will be copied to the destination directory /tmp/receiveDataTest in the Raspberry Pi)
  3. To run the generated .jar package successfully, It is necessary to tell Java where the native libraries for accesing the serial port (ie, the RxTx libraries) are stored. Specifically, it is necessary to set the system property java.library.path to /usr/lib/jni by calling java with the argument -Djava.library.path=/usr/lib/jni
  4. Due to a known bug in the RxTx library (at least in version 2.1.2), it will not be able to open /dev/ttyAMA0 by itself when running the generated example. To avoid it, set the Java system property gnu.io.rxtx.SerialPorts to /dev/ttyAMA0 by calling java with the argument -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0
  5. It is necessary to grant the user running the example permissions to access the serial port. For that purpose, the user must both belong to the dialout group or run the program with root permissions (sudo).
Overall, run the generated example with the command line:

java -Djava.library.path=/usr/lib/jni \
-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0  \
-cp /tmp/receiveDataTest/lib:. \
-jar /tmp/receiveDataTest/Xbee.DataReceive.jar

By running the previous command, the Java application launcher will run the file /tmp/receiveDataTest/Xbee.DataReceive.jar (or whatever was the name of the jar file generated when building the project) using the libraries stored in the subdirectory /tmp/receiveDataTest/lib with the suitable values for the system properties java.library.path and gnu.io.rxtx.SerialPorts as previously explained.

It is possible to get a warning message telling about a version mismatch between the RxTx installed version and that used when building the example, but it should not be a problem for starting watching frames in the console as soon as any 802.15.4 end node sent information.

Tuesday, 26 February 2019

Colorado: Accessing to 802.15.4 networks from Raspberry Pi. Hardware

Rasberry Pi B+ connected to a Digi Xbee 802.15.4 module
This document describes the integration between a Raspberry Pi and a Digi Xbee 802.15.4 module from a hardware perspective. The document is completed with the notes about the needed operations from a software perspective available here.

The objective of the Colorado project is developing a STEAM concentrator based on Raspberry PI accessing to a 802.15.4 network by using a Digi XBee module. To do that, it is necessary to connect the Raspberry with the Xbee module using a RS232 link, since both devices integrate at least one 232 serial port.

This document takes as base a Raspberry Pi board with a 40 pin connector (specifically RPi B+) and a Digi Xbee Pro S1 802.15.4 module. The description is suitable to be applied to any Digi Xbee module (S1, S2x, S3, standard or PRO) whenever the module specific power requirements were taken into account (see Powe Supply notes)

Serial connection

The modules connection can be simple, ie just by connecting the Tx-Rx lines, or can be more complex by connecting the hardware synchronization lines (RTS and CTS). In the first case a serial hardware control flow will NOT be feasible. Both wiring methods are covered in the next scheme, in which these connections can be seen:
  • Raspberry Tx output (pin 8) is connected to the Xbee DIN input (pin 3)
  • Xbee DOUT output (pin 2) is connected to the Raspberry Rx input (pin 10)
  • In order to provide hardware flow control support:
    • Raspberry RTS output (pin 11) is connected to the Xbee CTS input (pin 12)
    • XBee RTS output (pin 16) is connected to the Raspberry CTS input (pin 36)
Raspberry Pi - Digi Xbee connection diagram

If the hardware flow control option is being implemented, it will be necessary to allow Raspberry Pi to use its pins as RTS/CTS (disabled by default). To do that, follow the instructions defined in the VMW Productions site.

Power supply

Apart of the serial connection, it will be necessary to power the Xbee module from a supply generating, in case of using a Xbee S1 module, a voltage in the range 2,8V-3,4V and a max. current that will depend on the S1 module used, but that ranges from 50 to 340 mA (see power requirements on page 13 of the Xbee S1 User Manual) .

The Raspberry Pi uses four of its pins as power outputs (check full Raspberry Pi pinout here):
  • Pins 1 and 17 outputs 3,3V with a max current of 50mA. Though the voltage is in the Xbee voltage input range, the current is in the higher limit of the smallest module, so using this option is not recommended. Note, however, that in case of using a Xbee S2C (the standard version, NOT the pro version) the max current would be between 33 and 45 mA and therefore taking the power supply from these pins would be feasible.
  • Pins 2 and 4 outputs 5V with a max current up to 1500mA (depending on the RPi power supply). This current is suitable to power the Xbee module, but requires a voltage regulation.
In order to perform a voltage regulation, a TI TPS7A4700 regulator configured to output 3,3V is used. As can be seen in the previous schematic, the Raspberry Pi pin 2 output (+5V) is connected to the TPS7A4700 input, and its output (+3,3V) is connected to the Xbee module pin 1. To know more about the TI TPS7A4700, click here.


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.

Friday, 15 February 2019

Litems based on ESP32 processors

ESP32 evaluation board
ESP32 is a series of low-cost, low-power SoCs integrating Wi-Fi and dual-mode Bluetooth that have become the reference when talking about IoT (Internet of Things) devices, what means in a broad way low cost devices with Internet communication features.

The ESP32 devices offer better features than the famous Arduino (native Wi-Fi/Bluetooth dual communication, size, processor, memory, price) while using (among others) the same programming environment (Arduno IDE), putting together better performance and easy programming.

The ESP32 becomes a really interesting option for developing Litems:
  • using BLE both overcomes the Classic Bluetooth piconet size (max. 7 bluetooth slaves connected) and allows developing the concentrator as a software layer on a BLE enabled device (Raspberry Pi 3, any modern tablet or laptop), 
  • it offers enough processor power for developing virtually anything, 
  • its cost and size are reduced, 
  • being based on Arduino IDE, the programming learning curve is really short (there are thousands of examples and tutorials in Internet).

For a "Getting started" guide, visit Random Nerd Tutorials site.
For full information, visit the ESP 32 site.

Update (01/21)

An interesting option regarding small footprint is the SiP (System in Package) ESP32-PICO-D4: it is really small and it keeps most of the features of the bigger ESP32 options.  It is available as kit starting from 5$ with a footprint of 52x21mm.

Compared with the Arduino Nano 33 BLE, the ESP32-PICO-D4 is considerably cheaper (starting from 5$, average 8$ vs 17',5€), it offers WiFi and more Flash (4Mb vs 1Mb), though the Nano 33 footprint is smaller (45x18mm).

Tuesday, 12 February 2019

Colorado: Voltage regulator for XBee Pro 802.15.4 module

TI TPS7A4700 voltage regulartor board
In order to access/manage the 802.15.4 network, a Digi XBee Pro module is being integrated with a Raspberry Pi, the device where the STEAM gateway will run.

This module has a typical voltage input of 3.3V, with a consumption that depends on many factors (versions, PRO features and running modes). In the case of the Xbee Pro S1 international version with RPSMA antenna connector (Digi part number XBP24-ASI-001J), the consumption when transmitting is 150mA, far from the 50mA that the Raspberry Pi GPIO-40 pin 1 outputs.

Is therefore necessary relying on a external power supply or taking the voltage from the Raspberry Pi GPIO-40 pins 2 or 4, that outputs 5V with currents up to 1,5A (depending on the Raspberry Pi PSU). In this last case, a voltage regulator is necessary.

For that purpose, a good option is using a versatile low noise TI TPS7A4700 that, depending on the pin configuration, can output different voltages with a wide input voltage range (3-36V) and a maximum output current of 1A.

The board shown in the photo supports that flexible output voltage configuration by shorting the numbered solder pads and adding to the default 1.4V the value shown in the pad. For instance, shorting the pads 0.4 and 3.2 you get 1.4 + 0.4 + 3.2 = 5V, or shorting the pads 0.1, 0.2 and 1.6 you get 1.4 + 0.1 + 0.2 + 1.6 = 3.3V. The maximum output voltage is 20V.

The shown board can be bought in the TekDevice online shop or eBay.

Monday, 11 February 2019

Colorado projects started

STEAM Colorado/Elbert projects
A new branch in the project repository addressed to develop two new subprojects has been created. The new subprojects are:
  • Litem (Mount) Elbert project, addressed to develop a set of Litems based on the Texas Instruments CC26x2 Lauchpad evaluation board (see evaluation board clicking here), using 802.15.4 as network protocol for communicating with the gateway. The code is localted in the subdirectory SteamProject/software/litems/802.15.4/ti-cc26x2-lp/elbert/ of the GitHub repository (direct access clicking here). Given that Elbert works will be developed on a evaluation board, all the results will be considered as experimental.
  • Gateway Colorado (river) project, addressed to develop a gateway running on Raspberry Pi (Raspbian OS) implementing 802.15.4 in the underlying network by integrating a Digi Xbee module as interface. The code is located in the subdirectory SteamProject/software/gateways/802.15.4/raspbian/colorado/ of the GitHub repository (direct access clicking here). Colorado source code will be developed in Java and the expected result will be potentially feasible to be put into production.
These two projects will run in parallel, since it is necessary their mutual integration to have a practical result (litem without gateway and viceversa is nonsense). However, even being closely related, it is important to state that the individual results will be compatible with the STEAM specification, ie, Elbert will be compatible with any STEAM 802.15.4 gateway and Colorado will be compatible with any STEAM 802.15.4 litem.

Since both the Colorado river and the mount Elbert have strong relationship with the Colorado state, the above icon is selected to represent graphically these two projects.

For detailed Elbert project information (description, planning and current status) click here. For detailed Colorado project information (description, planning and current status) click here.

Sunday, 10 February 2019

GitHub repository created

STEAM project GitHub repository
A repository for becoming the project cooperative sourcecode base has been created and is available on GitHub (link here).

A skeleton directory structure is being created as first step,  and the works on the wiki with the project documentation  are in progress.

The skeleton structure contains readme files in each level, indicating what is its purpose, ie, what is expected to be stored there.

A project naming methodology has been defined to allow multiple project coexistence while simplifying the selection of project names. In that way, the naming methodology states these rules:
  • Litem project will take the name of a world mountain.
  • Gateway projects will take the name of a world river.
  • Controller projects will take the name of a world lake.
  • Manager project will take the name of a world sea.

Thursday, 2 August 2018

Texas Instruments CC26x2 Launchpad

SimpleLink CC26x2R Wireless MCU Lauchpad Development Kit
UPDATE: Pre-production silicon versions earlier than Revision E (from Jan 2019 on) will only support CC26X2 SDK 2.30 and earlier (SDK available clicking here). Silicon revision E and later will only be compatible with CC26X2 SDK 2.40 and later. Production silicon is expected to be launched on early second quater 2019.

As defined in the project roadmap, in the first stage some technology will be developed in parallel to the definition of interfaces and protocols.

To do that it is necessary to choose a powerful yet flexible evaluation board that allowed developing and testing different devices (vehicle controller, discrete actuator,...)

Texas Instruments has recently launched a new SOC (System On Chip) called CC2652R with interesting features:
  • Supports wireless communications based on the protocol 802.15.4 (as Bluetooth Low Energy, Zigbee, Thread or raw 802.15.4)
  • Supports wired communications as RS-232, I2C or SPI
  • Supports a wide range of analog and digital IOs and sensors (as, for instance, PWM outputs)
  • Allows programming from a solid, free, environment (Code Composer Studio, or CCS) in C/C++ over real time operating systems (both Texas Instruments RTOS or FreeRTOS)
  • It has a small form factor (VQFN) and contained price (around 3$)
In order to "play" with this little wonder, Texas Instruments has launched too an evaluation board called Simplelink CC26x2R Launchpad (shown in the photo) that allows an optimal integration between the CC2652R MCU and the programming environment (Code Composer Studio) thanks to its included JTAG interface. As can be seen, the evaluation board allows access to most of the MCU IOs, specifically the mapping of these IOS is defined in this table:

GPIO Id Pin Type Description CC26x2 Launchpad mapping Launchpad usage User usage
DIO_0 5 Digital Sensor controller DIO0 - DIO
DIO_1 6 Digital Sensor controller DIO1_RFSW ? ?
DIO_2 7 Digital Sensor controller UART(0)_RX UART -
DIO_3 8 Digital Sensor controller UART(0)_TX UART -
DIO_4 9 Digital Sensor controller I2C_SCL I2C interface -
DIO_5 10 Digital Sensor controller, high drive I2C_SDA I2C interface -
DIO_6 11 Digital Sensor controller, high drive PIN_RLED, PWMPIN0 Launchpad red led, PWM0 DIO high drive (removing Launchpad led jumpers)
DIO_7 12 Digital Sensor controller, high drive PIN_GLED, PWMPIN1 Launchpad green led, PWM1 DIO high drive (removing Launchpad led jumpers)
DIO_8 14 Digital SPI0_MISO SPI -
DIO_9 15 Digital SPI0_MOSI SPI -
DIO_10 16 Digital SPI0_CLK SPI -
DIO_11 17 Digital - Not used / Not documented ?
DIO_12 18 Digital DIO12, LCD_EXTCOMIN Sharp LCD boosterPack -
DIO_13 19 Digital PIN_BTN1 Launchpad button 1 -
DIO_14 20 Digital PIN_BTN2 Launchpad button 2 -
DIO_15 21 Digital DIO15 - DIO
DIO_16 26 Digital JTAG_TDO, high drive DIO16_TDO - DIO high drive
DIO_17 27 Digital JTAG_TDI, high drive DIO17_TDI - DIO high drive
DIO_18 28 Digital UART(0)_RTS JTAG UART UART (removing JTAG Rx/Tx jumpers)
DIO_19 29 Digital UART(0)_CTS JTAG UART UART (removing JTAG Rx/Tx jumpers)
DIO_20 30 Digital SPI_FLASH_CS SPI -
DIO_21 31 Digital DIO_21 - DIO
DIO_22 32 Digital DIO_22, LCD_ENABLE Sharp CLD boosterPack -
DIO_23 36 Digital/Analog Sensor controller, analog DIO23_Analog, LCD_POWER Sharp CLD boosterPack -
DIO_24 37 Digital/Analog Sensor controller, analog DIO24_Analog, LCD_CS Sharp CLD boosterPack -
DIO_25 38 Digital/Analog Sensor controller, analog DIO25_Analog - Analog
DIO_26 39 Digital/Analog Sensor controller, analog DIO26_Analog - Analog
DIO_27 40 Digital/Analog Sensor controller, analog DIO27_Analog - Analog
DIO_28 41 Digital/Analog Sensor controller, analog DIO28_Analog - Analog
DIO_29 42 Digital/Analog Sensor controller, analog DIO29_Analog - Analog
DIO_30 43 Digital/Analog Sensor controller, analog DIO30_Analog - Analog

The evaluation board pricing is around 40$ and, together with the fantastic CC26X2 Software Development Kit (available for Windows, Linux and MacOS) and Texas Instrument online developer tools allows start developing code in a record time.

This evaluation board together with all the defined software is chosen as technological resource for developing the LItems on the Elbert project

Some detailed photos of the evaluation board can be seen below:

TI SimpleLink CC26x2R Wireless MCU LaunchPad
General evaluation board view, with CC2652R MCU on first plane
TI SimpleLink CC26x2R Wireless MCU LaunchPad
Detail of the CC2652R MCU, its small size can be appreciated by comparing it with the left jumpers
TI SimpleLink CC26x2R Wireless MCU LaunchPad
Detail of the CC2652R MCU. At right and left the pins giving access to the MCU IOs can be seen
TI SimpleLink CC26x2R Wireless MCU LaunchPad
JTAG interface, on first plane the microUSB connector and reset button. The CC2652R MCU can be fully isolated from the onboard JTAG by removing all the jumpers on the photo, allowing both using external JTAG or using the onboard JTAG with other MCUs

Thursday, 26 July 2018

Upgrading a Digi Connectport X2 from Zigbee to 802.15.4 coordinator

Digi ConnectPort X2 coordinator
In order to create a star topology XBee/802.15.4 network, a coordinator is necessary. That coordinator will be the responsible of managing some aspects of the network and, optionally, acting as gateway to other networks.

I own an old Digi Connectport X2 with ZB firmware, therefore suitable to act as a coordinator of a Zigbee network. This device has an ethernet port that, properly configured, allows sending and receiving radio network packets to or from a TCP/UDP connection, what is really useful in order to make tests from any computer able to access to the ethernet gateway port.

Since I need to form not a Zigbee but a 802.15.4 network, some changes are necessary in order to convert the Connectport X2 Zigbee coordinator into a 802.15.4 coordinator. These are the steps to be done: Upgrading the X2 gateway and Xbee PRO radio module firmwares or, in the last case, replacing the radio module by a 802.15.4 compliant module.

Upgrading the X2 gateway firmware

In order to get the proper firmware, go to the Digi Support Page, "Firmware updates" section and search "Connectport X2 - 802.15.4 - Ethernet" (link here). In case that the installed version was older than the available versions, the best is updating first the POST firmware and then updating the Connectport X2D (that was the exact name of my gateway firmware) firmware. Both the POST and the gateway installed firmwares can be checked in the Gateway "Administration/System information" page. In this case I updated the firmwares to version 1.1.3 release 82002548_B for POST and version 2.17.1.2 release 82002549_G1 04/20/2017 for gateway firmware.

Upgrading the Xbee PRO radio module

After upgrading the gateway firmware, it is necessary upgrading the radio module. The way to do depends on the installed radio module:
  • If the gateway contains a Xbee Pro S2(B) module, it is not compatible with the 802.15.4 firmware and therefore it must be replaced by another, 802.15.4 compatible, radio module. The valid options are two:
    • Replacing it by a Xbee Pro S1 module: it is old, expensive and it will become deprecated on December 2018, so it is not a good option to buy one.
    • Replacing it by a Xbee Pro S2C module: better and cheaper than the S1 module, it is compatible with Connectport X2D from firmware version 2.17.1.1, so upgrading the gateway firmware to that version (or higher) is necessary.
  • If the gateway contains a Xbee Pro S2C module, just upgrade the firmware by downloading the latest from the Digi support page (go to the Digi Support Page, "Firmware updates" section and search "XBee / XBee-PRO S2C 802.15.4 Modules", link here). The usual firmware option should be that containing "TH" (through hole) in its name, that is addressed to the Xbee Pro through hole modules that usually are mounted in the X2 gateways. However, in case of trying to upgrade the module with a wrong firmware, the gateway will generate an error and the process will be aborted, so no risk in this step in case of choosing the wrong firmware.
In order to know the radio module used by the gateway, open a session via the gateway web interface and go to Configuration/Xbee Network/Gateway Firmware Update and check the radio type: If it is "Xbee-PRO XNet 2.5 / ZB / SE (0x1a47)" your gateway contains a Xbee Pro S2 radio module, being 0x1a47 the radio module hardware version. If not sure, the last option is just opening the gateway enclosure and checking the installed radio module.