Skip to content

05. Uploading Firmware

Marcelo Arredondo edited this page Aug 19, 2024 · 6 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

Arduino IDE & 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.

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.

  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+).

  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.

  • 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.

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.

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.

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 de dependencies packets from the requirements.txt.

Note

We recommend use virtual environment to avoid dependencies errors.

To install de requirements run the next command: pip install -r requirements.txt Requirements packets:

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

Important

To install python-magic may have additional dependencies depending on your OS, read more:

Available commands

Commands

Releases

Release commands Show the current releases loaded from the board version 3

Usage

To show the current releases run the next command:

$> python3 catnip_uploader.py releases
Releases available:
0: airtag_scanner_CC1352P_7.hex
1: airtag_spoofer_CC1352P_7.hex
2: sniffer_fw_CC1352P_7.hex
3: sniffle_CC1352P_7.hex

Load

load_commands
Load the selected firmware to the board, this command have two options.

  • Firmware: This options is a integer value from the index of the available firmware releases
  • Comport: The Path to the board serial com
Usage

Note

First you need to know the index of the firmware you want to upload, exec the releases command if you don't know what index you need.

$> python3 catnip_uploader.py load 0 /dev/cu.usbmodem101
Uploading airtag_scanner_CC1352P_7.hex to /dev/cu.usbmodem1101
Downloading airtag_scanner_CC1352P_7.hex
Uploading airtag_scanner_CC1352P_7.hex to /dev/cu.usbmodem1101
Opening port /dev/cu.usbmodem1101, baud 500000
Reading data from firmware.hex
Firmware file: Intel Hex
Connecting to target...
CC1350 PG2.0 (7x7mm): 704KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x000AFFD8
Primary IEEE Address: 00:12:4B:00:2A:79:C0:96
    Performing mass erase
Erasing all main bank flash sectors
    Erase done
Writing 720896 bytes starting at address 0x00000000
Write 208 bytes at 0x000AFF300
    Write done                                
Verifying by comparing CRC32 calculations.
    Verified (match: 0x99d1c8f1)
Done uploading airtag_scanner_CC1352P_7.hex to /dev/cu.usbmodem1101 

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

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

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