en:cc2538_bsl_manual  

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

You can update the module or stick firmware via a serial port using 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 entering 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

Switch device to bootloader mode

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

To switch 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 a 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 <FIRMWARE>

where:

/dev/ttyUSB0 - 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;

<FIRMWARE> - firmware file name in bin or hex format (you must specify the full path to the firmware file).

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

Automatic switch 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. modified version of cc2538-bsl 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
en/cc2538_bsl_manual.txt · Last modified: 2022/02/02 19:57 by Leonid Titov