Skip to main content
newbie_stm32
Associate III
April 25, 2023
Question

Flashing firmware using System Bootloader and STM32CubeProgrammer on Nucleo-G491RE

  • April 25, 2023
  • 9 replies
  • 4548 views

Hi, I am working on making firmware write work using System Bootloader and USART1 interface on NUCLEO-G491RE. I have a code snippet taken from the internet which jumps to the System Bootloader section of the code once the User Button is pressed. I have interfaced a USB to UART converter at PA9, PA10, and GND as suggested in the AN2606.

void BootloaderInit() {
	void (*SysMemBootJump)(void);
 
	volatile uint32_t addr = 0x1FFF0000;
	HAL_RCC_DeInit();
 
	SysTick->CTRL = 0;
	SysTick->LOAD = 0;
	SysTick->VAL = 0;
 
	__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();
	__disable_irq();
	SysMemBootJump = (void (*)(void)) (*((uint32_t*) (addr + 4)));
	__set_MSP(*(uint32_t*) addr);
	SysMemBootJump();
}

But once the User Button is pressed and tried to connect to the UART interface using STM32CubeProgrammer it shows


_legacyfs_online_stmicro_images_0693W00000bimIOQAY.pngWhy is the firmware upgrade not working?

This topic has been closed for replies.

9 replies

MM..1
Chief III
April 25, 2023

First check hw mode


_legacyfs_online_stmicro_images_0693W00000bimigQAA.pngafter this work try jump into.

newbie_stm32
Associate III
April 26, 2023

Hi, @mm_it..1​ I have already followed this and changed them using STM32CubeProgrammer using the ST-LINK option. I have opted for the first option on Pattern 15.

Please find those here, correct me if I have missed something.


_legacyfs_online_stmicro_images_0693W00000biq88QAA.png

MM..1
Chief III
April 26, 2023
image don’t show BOOT_LOCK and with this setup you always boot to system bootrom...
Senior III
April 25, 2023

Have you valid settings of UART connection? 9600 baudrate and parity even? Power from UART also connected?

newbie_stm32
Associate III
April 26, 2023

Hi, @kamil Duljas​ I have ensured the proper connection and those are as follows

USB to UART ----> NUCLUEO-G491RE

--------------------------------------------------------

TX -----> PA10 (CN10 pin 33)

RX -----> PA9 (CN10 pin 21)

5V -----> E5V (CN7 pin 6) with JP5 jumper position set to E5V

GND -----> GND (CN7 pin 22)

Please find this


_legacyfs_online_stmicro_images_0693W00000biqCUQAY.png

Senior III
April 26, 2023

How does your usb<->uart look like? It works with 5V or 3.3V? MY UART have jumper 3,3<->5V.

When I used STM32CubeProgrammer and UART I choosed 3.3V.

newbie_stm32
Associate III
April 26, 2023

Hi, @Kamil Duljas​ same here. It comes with a jumper to choose between 3.3V and 5V. I have connected it to 3.3V and the remaining 5V connection was fed to E5V on the Nucleo board.

Senior III
April 26, 2023

I think about this .... First at all, try enter to boot mode using jumper instead jump from program. We exclude errors in code

newbie_stm32
Associate III
April 26, 2023

Will try this out

Senior III
April 26, 2023

ttyACM0 is the only one USB on list?

newbie_stm32
Associate III
April 26, 2023

Yes

Senior III
April 26, 2023
  1. Additional tip: Add HAL_DeInit(); after HAL_RCC_DeInit();

Senior III
April 27, 2023

@newbie_stm32​  Some success?

Look at my settings:


_legacyfs_online_stmicro_images_0693W00000biwJvQAI.pngYou have simmilar board. try use jumper to connect. My result:


_legacyfs_online_stmicro_images_0693W00000biwKAQAY.png

newbie_stm32
Associate III
May 3, 2023

Hi @Kamil Duljas​, it did work for me. But when I tried it one more time, I got the same error message as shown before. I can assure you that connecting the BOOT0 pin to 3V3 and pressing RESET is keeping the MCU in the boot from system memory as there is blink code flashed to MCU with which after pressing RESET is not executing.

PS: I flashed using the system bootloader and immediately after that without disconnecting BOOT0 pressed RESET. After which I am not able to flash again using the system bootloader.

Senior III
May 3, 2023

Show me your connections

newbie_stm32
Associate III
May 3, 2023

Here it is
_legacyfs_online_stmicro_images_0693W00000bjHZ6QAM.png

newbie_stm32
Associate III
May 3, 2023

Can we achieve the same using Open Bootloader?

Senior III
May 3, 2023

I don't know. I didn't use open bootloader. Could you show me your bootloader code now?​

newbie_stm32
Associate III
May 4, 2023

Hi @Kamil Duljas​, Open Bootloader is an open project by ST and it can be found in the STM32CubeIDE > Target Selection >> Example Project >> OpenBootloader for NUCLEO-G491RE.

I am using it with no modification.