Flashing Firmware
After compiling a project for the stm32f767
platform, you need to flash the firmware to the board. This article describes how to connect to a board and flash using STM32CubeProgrammer.
Connect to the Board
We flash using ST-Link which is an interface to STM microcontrollers.
Development Boards + Dashboard
Most development boards (such as the Nucleo-144 and dashboard kit) have built-in ST-Link hardware and a USB interface.
Simply connect the board to your laptop with a USB cable.
Vehicle ECUs
The vehicle ECUs are not development boards. They are bare STM32F7 processors soldered to a circuit board. These boards do not have a built-in ST-Link or USB interface so we must use a different connector.
You will need and external ST-Link and a USB cable from the blue tool chest in the Hatch bay. Some of the ST-Links are Micro-USB and others are USB-C. We should have cables for both.
Please wrap the ST-Link in electrical tape since it has exposed conductors and is very easy to fry.
- Ensure the ECU is off (not receiving power) and the USB is not connected to your laptop.
-
Carefully connect the grey ribbon cable to the ST-Link and the JTAG connector on the ECU board.
Both ends of the ribbon cable have a tab which must align with the notch on the connector.
-
Power on the ECU. Talk to an upper year SW or Electrical member for help.
- Connect your laptop to the ST-Link using the USB cable.
Full setup:
Open CubeProgrammer
You installed Cube Programmer when Setting up your Development Environment. Run the program. It will open to a screen like this:
Connect to the STM32 with ST Link
- Select ST-LINK as the programming interface.
- Select the ST-Link device serial number. There should only be one option if you are plugged into a single device.
- Verify the ST-Link configuration.
- Click Connect.
Flash your program
- Switch to the Download window.
-
Select the binary file to flash. This is the
.bin
file located inracecar/firmware/build/PROJECT/PLATFORM/
-
Verify the flash configuration.
- Click Start Programming.
Troubleshooting
First flash succeeds, second fails
Disconnect from the ST-Link then reconnect. Wait a few seconds and click Start Programming again.
Cannot flash at all
You are connected to ST-Link but unable to flash.
- Is the ECU powered? The ST-Link is powered by your laptop but the ECU needs external power.
Cannot connect to ST-Link
The ST-Link serial appears but I cannot connect:
- Verify the ST-Link configuration.
The ST-Link serial number does NOT appear:
- Check your USB connections.
- Verify the ST-Link is receiving power by looking for LED lights.