Skip to main content
ANiko.3
Associate II
November 3, 2020
Solved

Flashing STM32MP1 custom board over JTAG

  • November 3, 2020
  • 4 replies
  • 4922 views

Hello,

I need to flash a custom STM32MP1 board which only has JTAG (no USB port available). Additionally, I build the image using Yocto meaning the output are separate binaries (e.g. U-Boot) and .tsv files.

The STM32CubeProgrammer detects the CPU with the ST-LINK/V2 in-circuit debugger. However trying to flash the device comes with the error:

```

Error: TSV files are not supported with JTAG/SWD debug interface

```​

Could someone give me more info on how I could flash over JTAG and by using the STM32CubeProgrammer? Or how I could flash in any other way (dont forget that Yocto generates separate binaries and the .tsv files).

This topic has been closed for replies.
Best answer by PatrickF

Hello,

it is unfortunately not possible to program external flash of MPU products using JTAG. USB is mandatory (UART can barely be used too). See https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer .

Is you board have a removable SD-Card ? SD-Card might be programmed outside the target. See https://wiki.st.com/stm32mpu/wiki/How_to_populate_the_SD_card_with_dd_command .

Regards.

4 replies

PatrickF
PatrickFBest answer
Technical Moderator
November 3, 2020

Hello,

it is unfortunately not possible to program external flash of MPU products using JTAG. USB is mandatory (UART can barely be used too). See https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer .

Is you board have a removable SD-Card ? SD-Card might be programmed outside the target. See https://wiki.st.com/stm32mpu/wiki/How_to_populate_the_SD_card_with_dd_command .

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
ANiko.3
ANiko.3Author
Associate II
November 3, 2020

Hello,

thanks for the answer. Nope, there is no SD-Card reader available, only JTAG.

Regards.

PatrickF
Technical Moderator
November 3, 2020

As workaround to your issue, for flashing only purposes, you might wire an USB connector by using only 3 pins (USB_DP2, USB_DM2, VSS).

This will need a modified uBoot to ensure VBUS and ID pins levels are not checked (see https://wiki.st.com/stm32mpu/wiki/How_to_configure_U-Boot_for_your_board#USB_OTG_node)

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
ANiko.3
ANiko.3Author
Associate II
November 3, 2020

Hello Patrick,

thanks for the answers. Is it somehow possible to boot over JTAG from an external device?

Regards.

PatrickF
Technical Moderator
November 3, 2020

JTAG is only available for debug/test.

It is possible to use 'Engineering boot' (pins BOOT[2:0] = 0b100) to get access and load FW to Cortex-M4 using CubeIDE.

It is as well possible for Cortex-A7 (e.g. to load TF-A binary in SYSRAM), but I think currently this need to use 3rd party debuggers.

But this is only for development purposes.

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
ANiko.3
ANiko.3Author
Associate II
November 3, 2020

Hi Patrick,

thanks for the quick answer. There is a USB port on the board, it operates as USB host though. Could it be possible to flash the device over that one by using STMCubeProgrammer or any other tool?

Regards.

PatrickF
Technical Moderator
November 4, 2020

If your USB host is connected to USB_DP2, USB_DM2 (not possible to flash on USB_DP1/DM1 as this are not connected to OTG IP), you could use a non-standard Type-A/Type-A cable during Flashing (risk of VBUS conflict if not disconnected on the cable, but usually not an issue as protected).

You need a specific uBoot for flashing (usually Id 0x03 in the Flashlayout TSV), different of the one expected to be used (flashed) in your application (other Id in the TSV).

This specific uBoot (loaded in RAM) need to define OTG device to be used for USB_DP2/DM2 whereas you 'normal' uBoot could use USBH.

To force OTG to ignore VBUS and ID (as usually not present), you should add in the Device Tree the force-b-session-valid; and hnp-srp-disable; on the &usbotg_hs node.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
ANiko.3
ANiko.3Author
Associate II
November 4, 2020

Hi Patrick,

my custom board is completely empty (theres nothing on it). Since I need a specific U-Boot for flashing, how could I load it in RAM, is something like that even possible?

Regards.