Skip to content

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.

nucleo stlink
ST-Link on Nucleo-144 F767ZI

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.

ST-Link and cables are kept in bags in this drawer. Return them when finished!

Please wrap the ST-Link in electrical tape since it has exposed conductors and is very easy to fry.

E-Tape would have prevented the Great ST-Link Massacre of Comp '24.
  1. Ensure the ECU is off (not receiving power) and the USB is not connected to your laptop.
  2. 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.

    Connector tab and notch

  3. Power on the ECU. Talk to an upper year SW or Electrical member for help.

  4. 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:

  1. Select ST-LINK as the programming interface.
  2. Select the ST-Link device serial number. There should only be one option if you are plugged into a single device.
  3. Verify the ST-Link configuration.
  4. Click Connect.

Flash your program

  1. Switch to the Download window.
  2. Select the binary file to flash. This is the .bin file located in

    racecar/firmware/build/PROJECT/PLATFORM/
    
  3. Verify the flash configuration.

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

The ST-Link serial appears but I cannot connect:

  1. Verify the ST-Link configuration.

The ST-Link serial number does NOT appear:

  1. Check your USB connections.
  2. Verify the ST-Link is receiving power by looking for LED lights.