How do I program devices with a firmware?

Once we have compiled the source code with the SDK we will have a binary file. This binary file needs to be programmed into the CPU on the hardware before we can run it. This post goes through how to perform this programming on two different hardware setups.

Generally speaking, we need a JTAG to program the devices. This is hardware made for programming and debugging purposes. You can find and use JTAG on TI Launchpad (cc1310, cc1350, cc2650) and TI SmartRF06EBK boards. These can be used to program other hardware targets (eg TI sensortag, Weptech IoT gateway) by using the 10-pin small ARM JTAG cable.

Software installation

Install SmartRF Flash programmer 2 from Texas Instruments. Note, there are two Flash programmer applications, use Flash programmer 2. This installs the drivers for the Launchpad as well.

Program a CC13xx or CC26xx target

For this example, we will program a TI Launchpad. All the TI Launchpads with CC1310, CC1350, or CC2650 are flashed in the same way. To use the JTAG of a Launchpad to program a target on another PCBA, unmount the headers and connect as shown in the section below.

Programming

After installing Flash programmer 2, plug in a Launchpad with a USB cable.

It should show up in the Flash programmer 2 interface. In the pane on the left, there will be an item called XDS110, XDS-L20000QI. Direcly under that it will say CC1310. If not, try rebooting the computer and/or removing and re-inserting the Launchpad. Click on the CC1310.

If Flash programmer 2 says that the debug interface is locked, you need to run a force erase command. Click the large wrench-icon in the top right corner of the Flash programmer 2 interface. Click the Force erase corresponding to the device you have connected (cc2538 or cc13xx/cc26xx).

  1. Set the binary to program: click Browse and navigate to the binary file. It will have the extension .bin. For cc1310/cc1350/cc2650 it will be 128 kB.
  2. Set up the flash address: for cc1310/cc1350/cc2650 it should read 0x0.
  3. Set up actions: we want to erase, program, and verify the device. Make sure all three checkboxes are ticked and set according to the picture.
  4. Press the large Play button to start the process.

Troubleshooting.

Sometimes Flash programmer 2 fails, then simply try again. It may take a 2-3 tries.

If that doesn't help, try changing USB cable to the Launchpad.

If you are using a USB hub, try removing that and connect directly to the computer.

If you have peripherals connected to the Launchpad, such as external sensors or LEDs or such, try removing those since the extra power draw may make the flashing unstable. It takes a relatively large amount of power to erase and write to flash.

Ensure the JTAG cable, if used, is seated correctly and in the right orientation.

Ensure JTAG jumpers are mounted, or unmounted, depending on whether you are programming an external target or not.

Program a CC2538 target

Programming a CC2538-based target is slightly different from CC13XX/CC26XX. As example target, we will use the Weptech IoT-gateway which is based on CC2538 with a CC1200 radio transceiver and an ENC28J60 ethernet chip. We will use the JTAG built in on the Launchpad.

Programming

To program the Weptech, we will use the JTAG interface on the Launchpad. To do so, we will disconnect the JTAG from the cc1310 on the Launchpad by removing the jumpers as seen in the following picture. Note that to later be able to again flash the Launchpad cc1310, you need to reconnect the jumpers.

Remove the jumpers as shown in the picture.

Connect the JTAG cable as shown in the picture, from the header named XDS110 Out on the Launchpad, to the header on the Weptech Gateway.

Open SmartRF Flash programmer 2 and look for the XDS110, XDS-L20000QI or similar, which directly under would say CC2538. Press the CC2538. If you get a dialog box saying that the debug interface is locked, you need to perform a forced full erase, just as above, but pick CC2538 Forced Full Erase instead.

Find the correct binary file for the gateway. It should be 512 kB large.

The address for the cc2538 is 0x200000.

Set everything else up just as above, then press the Play button to start flashing.