Warning Cookies are used on this site to provide the best user experience. If you continue, we assume that you agree to receive cookies from this site. OK

Flashing TI CC2538/CC2652 modules and sticks using the cc2538-bsl utility

You can update the module or stick firmware via a serial port through the built-in serial bootloader in the CC2538 and CC2652 microcontrollers using the cc2538-bsl utility .

Important: to flash the device via the serial port, the device must be put into bootloader mode. The procedure for switching to bootloader mode depends on the software installed on the device and may not be compatible or supported by JetHome devices. Therefore, the operation of the mechanism for switching to bootloader mode for third-party firmware is not guaranteed. Use only recommended firmware. See software for modules based on TI CC2538 chip and software for sticks and modules based on TI CC2652P1 chip

Installing the utility

For the utility to work, you need to install additional packages:

 pip3 install pyserial intelhex python-magic

You can download the utility with the command:

 git clone https://github.com/JelmerT/cc2538-bsl.git

Switching the device to bootloader mode

For firmware, the microcontroller must be put into bootloader mode (serial bootloader).

To switch the stick to bootloader mode, you must:

  • Disconnect the stick from the USB port;
  • Press the "FLASH" button on the stick board;
  • Without releasing the "FLASH" button, insert the stick into the USB port of the computer;
  • After that, the "FLASH" button can be released.

To switch the module to bootloader mode, see the documentation for the module.

Firmware

An example of a command for flashing a device (from the directory where the flashing utility was installed):

 python3 cc2538-bsl.py -p /dev/ttyUSB0 -e -v -w 

where:

/dev/ttyUSB0 is the serial port device file corresponding to the connected one. May differ from the example shown depending on the operating system and the number of devices connected to the computer. For sticks connected to a Linux computer, this is /dev/ttyUSB*. For modules, see the documentation for the device in which the module is installed;

- the name of the file with the firmware in bin or hex format (you must specify the full path to the file with the firmware).

When specifying the -e option, the entire internal flash memory of the microcontroller is completely erased before flashing it.

Automatic switching to bootloader mode for sticks

JetHome sticks have the ability to automatically reset the stick and switch it to bootloader mode for flashing without having to disconnect the stick from the USB port and press a button on it. A modified version of the cc2538-bsl utility is required to use this feature.

This version of the utility has added the –invoke-bootloader=METHOD command line option, which sets the algorithm used to switch to bootloader mode. Available values for the METHOD parameter:

  • 0 - disables the bootloader activation procedure. At the moment, the original cc2538-bsl utility always starts the bootloader activation procedure using the DTR and RTS lines;
  • 1 - the bootloader activation procedure is used in case of independent connection of the DTR and RTS control lines to the microcontroller. This procedure is used by default and is similar to the procedure used by the original utility;
  • 2 - the bootloader activation procedure is used in case of connecting the DTR and RTS control lines according to the scheme with protection against unintentional reset of the microcontroller, similar to that used in NodeMCU modules.

For the utility to work, you must also install additional packages:

 pip3 install pyserial intelhex python-magic

Method "2" is used to enter bootloader mode. An example command for flashing a JetHome USB stick in this case would be the following:

 python3 cc2538-bsl --invoke-bootloader=2 -p /dev/ttyUSB0 -e -w CC1352P2_CC2652P_launchpad_coordinator_20210120.hex