# Update the firmware with RL-programmer on Linux with stlink
# Step 1. Download firmware
Download the latest firmware from Update the firmware page.
# Step 2.1. Install software
At the moment of writing, the latest stable version of ST-link software from APT is v1.7.0 on Apr 25, 2021 and it doesn't support STM32G0B (Chip-ID 0x467) (opens new window). Instead of using binary releases, follow the instructions from the official st-link manual on Compiling from sources (opens new window).
Here's a summarized version for a quick setup:
Remove Older Versions: Make sure you uninstall any older versions of st-link on your system.
sudo apt remove --purge libstlink1 stlink
Clone the Latest st-link Repository: Clone the official st-link repository from GitHub.
git clone https://github.com/stlink-org/stlink.git
Install libusb
sudo apt-get install git make cmake libusb-1.0-0-dev
Build and Install: Navigate into the cloned directory and install the software.
cd stlink/ make release sudo make install sudo ldconfig
# Step 2.2. Connect the programmer
TIP
Be sure that your SWD pins on the node and the needle sides are connected correctly (3.3 to 3.3, GND to GND).
Prerequisites are: RL Programmer-Sniffer, SWD-NEEDLE (opens new window) and JST-GH 4 cable. An example of a connection is shown below.
TIP
SWD and CAN sockets look similar and they use the same 4-pin cable. SWD has 3.3V, but CAN has 5V. Don't mix them up.
TIP
On the RL programmer VUSB
led should be orange, 3.3
led should be red, ST-link
led should be blue, and blink
led should blink with yellow. If they are not, probably you are making something wrong. It also may indicate that the board works incorrectly.
# Step 2.3. Upload the firmware
It is expected to use the latest version of st-link installed from sources:
Program the Firmware:
To program the boards with stm32f103 (they all have version v2), you should explicitly specify the flash size (128 KBytes):
st-flash --flash=0x00020000 --reset write desired_bin_file.bin 0x8000000
For boards with stm32g0 (they all have version v3), you should type:
st-flash --reset write desired_bin_file.bin 0x8000000
Make sure to replace
desired_bin_file.bin
with the path to your actual firmware file.Verification:
After the process completes, ensure that the firmware has been successfully uploaded (check stlink messages). Confirm that the device operates correctly.
Issues:
I have
unknown chip ID!
error.Please, install the latest version of st-link.