OpenThread on CC2538 Example
This directory contains example platform drivers for the Texas Instruments CC2538.
The example platform drivers are intended to present the minimal code necessary to support OpenThread. As a result, the example platform drivers do not necessarily highlight the platform's full capabilities.
Toolchain
Download and install the GNU toolchain for ARM Cortex-M.
In a Bash terminal, follow these instructions to install the GNU toolchain and other dependencies.
$ cd <path-to-openthread>
$ ./script/bootstrap
Building
In a Bash terminal, follow these instructions to build the cc2538 examples.
$ cd <path-to-openthread>
$ ./bootstrap
$ make -f examples/Makefile-cc2538
CC2592 support
If your board has a CC2592 range extender front-end IC connected to the CC2538 (e.g. the CC2538-CC2592 EM reference design), you need to initialise this part before reception of radio traffic will work.
Support is enabled in OpenThread by building with CC2592=1
:
$ make -f examples/Makefile-cc2538 CC2592=1
The default settings should work for any design following the integration advice given in TI's application report "AN130 - Using CC2592 Front End With CC2538".
Additional settings can be customised:
CC2592_PA_EN
: This specifies which pin (on port C of the CC2538) connects to the CC2592'sPA_EN
pin. The default is3
(PC3).CC2592_LNA_EN
: This specifies which pin (on port C of the CC2538) connects to the CC2592'sLNA_EN
pin. The default is2
(PC2).CC2592_USE_HGM
: This defines whether the HGM pin of the CC2592 is under GPIO control or not. If not, it is assumed that the HGM pin is tied to a power rail.CC2592_HGM_PORT
: The HGM pin can be connected to any free GPIO. TI recommend using PD2, however if you've used a pin on another GPIO port, you may specify that port (A
,B
orC
) here.CC2592_HGM_PORT
: The HGM pin can be connected to any free GPIO. TI recommend using PD2, however if you've used a pin on another GPIO port, you may specify that port (A
,B
orC
) here. Default isD
.CC2592_HGM_PIN
: The HGM pin can be connected to any free GPIO. TI recommend using PD2, however if you've used a pin on another GPIO pin, you can specify the pin here. Default is2
.CC2592_HGM_DEFAULT_STATE
: By default, HGM is enabled at power-on, but you may want to have it default to off, specifyCC2592_HGM_DEFAULT_STATE=0
to do so.CC2538_RECEIVE_SENSITIVITY
: If you have tied the HGM pin to a power rail, this allows you to calibrate the RSSI values according to the new receive sensitivity. This has no effect ifCC2592_USE_HGM=1
(the default).CC2538_RSSI_OFFSET
: If you have tied the HGM pin to a power rail, this allows you to calibrate the RSSI values according to the new RSSI offset. This has no effect ifCC2592_USE_HGM=1
(the default).
Flash Binaries
If the build completed successfully, the elf
files may be found in <path-to-openthread>/output/cc2538/bin
.
To flash the images with Flash Programmer 2, the files must have the *.elf
extension.
$ cd <path-to-openthread>/output/cc2538/bin
$ cp ot-cli ot-cli.elf
To load the images with the serial bootloader, the images must be converted to bin
. This is done using arm-none-eabi-objcopy
$ cd <path-to-openthread>/output/cc2538/bin
$ arm-none-eabi-objcopy -O binary ot-cli ot-cli.bin
The cc2538-bsl.py script provides a convenient method for flashing a CC2538 via the UART. To enter the bootloader backdoor for flashing, hold down SELECT for CC2538DK (corresponds to logic '0') while you press the Reset button.
Interact
- Open terminal to
/dev/ttyUSB1
(serial port settings: 115200 8-N-1). - Type
help
for list of commands.
> help
help
channel
childtimeout
contextreusedelay
extaddr
extpanid
ipaddr
keysequence
leaderweight
mode
netdata register
networkidtimeout
networkkey
networkname
panid
ping
prefix
releaserouterid
rloc16
route
routerupgradethreshold
scan
start
state
stop