Skip to content

05. Uploading Firmware

Marcelo Arredondo edited this page Jan 31, 2025 · 12 revisions

Warning

⚠️⚠️Before you load any firmware check on your CatSniffer which CC1352 model you have (CC1352P or CC1352R for Catsniffer v1.x and v2.x and CC1352P7 for Catsniffer v3.x) and use the correct firmware .hex file for your chip. IF YOU FLASH THE INCORRECT FIRMWARE TO YOUR BOARD IT MAY GET STUCK AND IT WILL NOT ALLOW YOU TO RE-PROGRAM BY BOOTLOADER. Only v3.x can be erased internally using the RP2040 as a JTAG programmer. For versions 1 and 2 you will need an external programmer to recover the board. ⚠️⚠️

RP2040 & SAMD21

.UF2 Recommended for RP2040

Note

This is the method we recommend using for loading firmware to the RP2040, the .UF2 files for RP2040 can be found on the repository. For the SAMD21 you can create an .UF2 file out of any of the available .ino programs, but we recommend just using the Arduino IDE.

  1. Connect the board to the computer

  2. Locate the desired firmware in the repository and save it locally. (make sure it is the correct version for your board)

  3. Open the file location on the file explorer

  4. Double tap the Reset0 button on the board to put the RP2040 in bootloader mode

  5. A file explorer window will open for your board

  6. Drag and drop the .UF2 file into the file explorer window for the board

  7. If the correct version was copied, the window should close automatically, if not close it manually and check for the correct firmware

  8. Reset your board


Drag and Drop Firmware

Arduino IDE for SAMD21

Important

This is the method we recommend using for loading firmware to the SAMD21, the .ino files can be found on the repository and can be uploaded using the Arduino IDE using Electronic Cats SAMD Arduino Core. Using the Arduino IDE with the RP2040 is possible directly via USB with the Arduino Mbed RP2040 Core, it is important to acknowledge one bug inside the Arduino Core for the RP2040, and it's mandatory to change one line of code inside the core. Firmware can also be uploaded to the SAM21 using a .UF2 file, the files will also be available on the repository.

The Arduino Integrated Development Environment – or Arduino Software (IDE) – contains a text editor for writing code, a message area, a text console, a toolbar with buttons for standard functions, and a series of menus. It connects to different boards to upload programs and communicate with them.

You need to download and install Arduino IDE; you can find it here.

After installing Arduino IDE, open it, and you will see the following window.


Arduino IDE Main View

The next step to use our boards is to install the board’s core in the Arduino IDE. Here is a quick guide on how to install them:

Installing the Arduino SAMD core:

You must install the latest Arduino SAMD core.

  1. In the menu bar, select Tools > Boards > Board Manager.


Board Manager Menu

  1. A side window will open and in the search bar, write SAMD, a list of cores will appear, click on the install button for Arduino SAMD Boards (32-bits ARM Cortex-Mo+).


Board Manager

  1. Installing the Electronic Cats SAMD Arduino Core: https://electroniccats.github.io/Arduino_Boards_Index/package_electroniccats_index.json

Arduino allows us to add custom cores or support for non-Arduino boards using the board manager. To do this we need to add a URL on the board manager configuration. Go to File>Preferences>Additional boards manager URLs.


Preferences Menu


Preferences


Additional Boards Manager URLs Window

  • Press the "OK" button.
  • Open the "Boards Manager" that is in Tools > Board > Board Manager.
  • Now write Electronic Cats in the search bar.
  • Click on install, wait for the installation to finish, and close the window.
  1. In Tools > Boards, scroll down in the board list until you see the Electronic Cats SAMD boards.


ElectronicCats Boards Installed

After downloading the core, you can upload the .ino files from the repository like you would do for any other board using the Arduino IDE.

CC1352P7/P1/R1

Important

It is really important to correctly identify the type of CC1352 chip that your board has. Loading the incorrect firmware to your board may get it stuck and it will not allow you to reprogram it by bootloader. Identifying which type of board you have is really simple, just hold your board up on a well lit space and read the inscription on the chip marked in the photos below. If you are not able to read the chip you can shine a flashlight or camera flash onto the board to be able to read it better. We also recommend using a magnifying glass or taking a close up picture with the camera flash on of the chip. If your board is a v3.x the chip should be a CC1352P7.The real issue is with v1.x and v2.x boards. This version can have either a CC1352P1 or a CC1352R1. If you flash either chip with the incorrect firmware you risk bricking your board and it will only be possible to recover using an external cJTAG programmer.

This script works to upload firmware from the releases page to the CatSniffer Board V3.x.

Important

The current version of the Catnip requires the lasted version of the SerialPassthroughwithboot-(v1.1)

Getting Starter

The struct files from the repo is:

.catnip-uploader:
├── catnip_uploader.py
├── cc2538.py
├── releases.json
└── requirements.txt

To initialize first we need to install all the requiered packets.

Note

We recommend use virtual environment to avoid dependencies errors.

To install the requirements run the next command: pip install . Requirements packets:

  • typer==0.9.0
  • pyserial==3.5
  • requests==2.31.0
  • intelhex==2.3.0
  • python-magic==0.4.27

install_requierments

If you are working on Linux his will also setup the the tool so it is useable from anywhere on the enviorment, removing the need to be on the tool's route.

Available commands

To check available commands we can use the command python catnip_uploader.py --help from a terminal on the folder containing the tool.

help_command

Releases

To check the list of firmwares available to load to the board we can use the command python catnip_uploader.py releases

releases_command

This command shows the avilable releases pulled from the CatSniffer-Firmware repository.

Load

To load firmware to our board we can use the load command. For more information about the command we can run python catnip_uploader.py load --help.

load_command

Arguments

We can see that the command requiers two arguments, the firmware that we want to load and the COM port of our board. In previous version we needed an integer index value of the firmware that we could check using the releases command. In the latest version we can just use a word contained in the firmware name. For example for sniffer_fw_cc1252p_7 we can just use sniffer. If we use a word that is shared by more than one firmware the tool will take the first option from the releases list. For example with airtag the tool has to decide between airtag_scanner_cc1352p_7 and airtag_spoofer_cc1352p_7. We can get around this by specifying more like airtag_spoofer or just use another word like scanner.

Options

The load command has two options available: --validate: On the latest version of the tool, before loading any firware the tool will ask you if you sure you want to uplaod the firmware.

load_no_validate

If you want to avoid this you can add the option --validate to the skip the check.

load_validate

--help: You can use this option to get more information about how to use the load command.

load_help

Usage

To use the tool we just need to send the load command with the desired firmware and the correct COM port for our board.

load_validate

One thing to keep in mind is that we need to restart the board between uploads or we could encounter an error.

synch_error_load

After finished you can use the CatSniffer with the selected firmware.

This was the procedure to flash the CatSniffer. Try all our custom firmware!

Using the Python tool is the easiest and most recommended way to flash firmware to the CC1352, since it works on any operating system. But before we start there are some preparations we need to do in order to use the python tool.

  1. Download the python tool from our repository or clone the whole repository (recommended) to your computer.

  2. Upload the SerialPassThroughWithBoot firmware to your board's main chip.

  3. Download Python using the following link. Look for the Operating System of your preference, in this case we use Windows.

  1. After the download is complete, install the software.
  2. We recommend that you select the ‘Add to PATH’ option when installing it so you do not have to do it manually later.

  1. Some python plugins are required, we can install them using the command line.
  • On the search bar, type CMD, and run it as administrator.

  • Execute the following commands to install the plugins.

    • pip install pyserial

    • pip install intelhex

    • pip install python-magic

  1. When the installation is finished, open a new cmd window or clean the console with the cls command. Then go to the path where you saved the python tool (cc2538-bsl.py) found on our repository using the cd command: cd <directory_route>

  2. Open the folder where you saved the python tool and copy the desired firmware (the one you are going to load to the board) onto the same folder where you have the python tool.

  3. Now run the command: python cc2538-bsl.py -h

  4. The following menu will come up

  1. To continue with the process you need to know which COM port number has been assigned to your CatSniffer. Go to Device Manager and look for your CatSniffer device. For this example COM90 is what we are looking for.

  1. Return to the cmd console and run the command python cc2538-bsl.py -p COMXX. The argument -p is used to open the port, if the port is opened, then the connection was successful.

  1. Put your CatSniffer in bootloader mode and then write in console
python cc2538-bsl.py -e -w -v -p COM39 sniffer_fw_CC1352R.hex. 

The argument -e erase the memory, the -w write on the chip and -v verify the image, the last parameter is the name of the file with extension. The .hex file must be on the folder cc2538-bsl.

  1. LED 4 will start blinking once the procedure finishes, indicating that CatSniffer has been successfully flashed.

Check out this video about Getting Started with the Catsniffer. For common issues with this method, please check our FAQ section.

Recover your board

If you have encountered an issue with your board that is not letting you load any firmware to the cc1352 in your board, please check out the section on how to recover your board.

Clone this wiki locally