-
Notifications
You must be signed in to change notification settings - Fork 72
05. Uploading Firmware
Warning
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.
-
Connect the board to the computer
-
Locate the desired firmware in the repository and save it locally. (make sure it is the correct version for your board)
-
Open the file location on the file explorer
-
Double tap the Reset0 button on the board to put the RP2040 in bootloader mode
-
A file explorer window will open for your board
-
Drag and drop the .UF2 file into the file explorer window for the board
-
If the correct version was copied, the window should close automatically, if not close it manually and check for the correct firmware
-
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:
You must install the latest Arduino SAMD core.
- In the menu bar, select
Tools > Boards > Board Manager
.
- 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+).
- 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
.
- If you already have a URL in the space there, you can click the button to the left, jump to another line and paste the Electronic Cats URL there. https://electroniccats.github.io/Arduino_Boards_Index/package_electroniccats_index.json
- 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.
- 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.
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.
-
Download the python tool from our repository or clone the whole repository (recommended) to your computer.
-
Upload the SerialPassThroughWithBoot firmware to your board's main chip.
-
Download Python using the following link. Look for the Operating System of your preference, in this case we use Windows.
- After the download is complete, install the software.
- We recommend that you select the ‘Add to PATH’ option when installing it so you do not have to do it manually later.
- 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
-
-
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>
-
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.
-
Now run the command:
python cc2538-bsl.py -h
-
The following menu will come up
- 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.
- Return to the cmd console and run the comman
d 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.
- 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.
- 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)
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:
Show the current releases loaded from the board version 3
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 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
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.
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.
-
- What is the CatSniffer?
- How can I use CatSniffer?
- What are the features of the CatSniffer?
- What can I do with the CatSniffer?
- What IoT protocols are supported by CatSniffer?
- How can I restore the CC1352 firmware on CatSniffer?
- How can I restore CC1352 firmware with RP2040 for CatSniffer V3?
- ERROR: Timeout waiting for ACK/NACK after Synch (0x55 0x55)
- What if SmartRF Packet Sniffer 2 doesn't detect my board?
- Why I got the error: unistd.h no such file or directory?
- Why CatSniffer can not connect with Zigbee2MQTT?
- What does this button do?