on
2021-12-16
08:03 AM
- edited on
2024-08-04
11:44 PM
by
Laurids_PETERSE
The bootloader inside STM32 families uses the protocol described in AN3154. It is supported by the STM32F1, F2, F4, F7, L4 series.
The purpose of this article is to give a guide on how to connect to a STM32 CAN bootloader Target, to erase and program the device through this interface.
First, one needs to identify if the targeted MCU supports the CAN bootloader. The CAN peripheral on the device is condition necessary, but not sufficient. In this guide the STM32F429ZI Nucleo will be used as an example.
The procedure can be summed up in couple of steps:
1. How to activate the bootloader mode on target device.
2. How to identify the CAN bootloader pins.
3. How to connect to the CAN interface.
4. How to program the MCU using CAN Bootloader
5. How to program the MCU using CAN Bootloader – from a script
6. How to connect to the FDCAN bootloader
The connection to the debugger can be done by SWD with default parameters.
With the hardware connection set up, both boards connected to power via USB, the connection can be now established. Moving back to CubeProgrammer, the connection is as simple as selecting the CAN interface. If the connection is successful, the content of the memory should appear.
Baudrate and other settings should be kept at default values
When the connection is successful, content of the memory should appear
The CubeProgrammer also comes with CLI version (command-line-interface). That can be used for automation of the programming process through the bootloader.
The CLI version is in the same installation folder as the CubeProgrammer GUI. Usually:
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\ STM32_Programmer_CLI.exe
Invoking the CubeProgrammer CLI from command line without any parameters will list all possible configurations.
In this example, the CAN configuration can be used as follows:
STM32_Programmer_CLI.exe -c port=CAN
Downloading a binary to the device is then as simple as providing the connection parameters and a path to the binary:
STM32_Programmer_CLI.exe -c port=CAN -d C:\STM32F429ZI_Nucleo_144.hex
These commands can be used in a script on the host PC, allowing the automation of e.g. programming process.
Unfortunately, currently there is no such solution as for the standard CAN. The FDCAN bootloader protocol described by the AN5405 is slightly different from the CAN BL protocol, therefore ST-Link V3 bridge cannot be used. ST-Link V3 would also require an interface (another MCU) to forward the CAN messages to the FDCAN bus.
Since the FDCAN BL is using the full features of the FDCAN bus in the default configuration (FD mode with Bit Rate Switching), any old CAN solution cannot be used.
There are two options what to use.
Hii
I am having problem with communication to CAN Bootloader.
Can you help me in sorting out the problem?
thanks
Goodday,
Can you please clarify this statement: "This tool features no transceivers either, so to connect to a PCB with transceivers an add-in board with transceiver is required", what do you mean by an add-in board?
Hi and thanks for the nice article!
After some time I'd like to know if something new is available regarding point 6.
Is some ready-to-use solution available to connect to the FDCAN bootloader? @Filip SCHWANK
Thanks!
Could you please inform me of the version of CubeProgrammer you used in this article? The latest 2.16.0 interface is different from the CubeProgrammer you used in this article
Hello! Where did you get the Bridge CAN schematic? The figure name is "17.png" in this article.
Hi,
@Gsing.2 ,
You can submit your issue to the community forum or our ticket system https://st.com/ols
The STLinkV3 does not feature any transceivers onboard, only the CAN pins directly from the MCU, therefore if a PCB you want to connect to has the standard 9 pin connector for example, there is usually a transceiver. In which case you would need another board between STLink and the PCB with transceiver for the STLink so that both boards can communicate with each other through CAN.
The STLinkV3PWR features the STM32H7 that supports FDCAN, however the CubeProrammer support is still under development. The latest release target is Q3 2024.
The CubeProrammer version used in this article was 2.7.0.
The diagram comes from the documentation for the STLinkV3. I took a snippet to depict the circuitry of the CAN bridge.
Best regards,
Filip Schwank & TOMAS Team
Hello, can the PB12 pin be configured as the CAN2 Rx instead of the PB5 pin for the Bootloader? I'm using the STM32F446RE for my application.