cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-F439ZI System Bootloader error with UART1/UART3 - Can't get a reply.

JGagnon
Associate II

Hello,

I am using the NUCLEO-F439ZI and would like to do a firmware updare through the System Bootloader using either UART1 or UART3, jumping to the system bootloader through user code. However, no matter what I do, I can't get the System Bootloader to reply to the activation command 0x7F

Documents used :
-AN2606 rev64 - STM32 microcontroller system memory boot mode
-AN3155 - USART protocol used in the STM32 bootloader
-RM0090 - STM32F405/415, STM32F407/417, STM32F427/437 and STM32F429/439 advanced Arm®-based 32-bit MCUs
-UM1964 - STM32 Nucleo-144 boards (MB1137)



Modifications made on the NUCLEO-F439ZI:
- Removed the 0Ohm resistor on SB5 and SB6 to cut the connection going to the Nucleo ST-LINK USART3 and make sure no interference is on the USART3 Line.

Workbench setup :
-
OS : LinuxMint (ubuntu based)
- Serial : FTDI 3V3TTL USB Cable @/dev/ttyUSB0
- A cheap logic analyzer with Saleae software to look at the traces

Putting the STM32F439ZI in system bootloader through user code :
The following function is used to jump to the system bootloader from the user code

 

 

 

static void jump_to_sysmem(void)
{

	void (*sysmem_boot_jump)(void);

	__disable_irq();

	HAL_RCC_DeInit();

	SysTick->CTRL = 0;
	SysTick->LOAD = 0;
	SysTick->VAL = 0;

	HAL_DeInit();

	__HAL_REMAPMEMORY_SYSTEMFLASH();

	sysmem_boot_jump = (void (*)(void)) (*((uint32_t *) 0x1fff0004));

	__set_MSP(*(uint32_t *)0x1FFF0000);

	__enable_irq();

	sysmem_boot_jump();
	while(1);
}

 

 

 

Which is called from the main function.

Issue description:
I know that the code is running correctly because I can connect to the board with the USB in DFU mode, which is one way to get into the system bootloader.

However, when trying to connect through USART1/USART3, I send the activation byte 0x7F, either through CubeProgrammer or through Cutecom, and there is never a response from the chip.

JGagnon_0-1727191110695.png

I tried through USART1 PA9/PA10 (with 100k Pull-ups, as described in AN3155), USART3 PB10/PB11 and USART3 PC10/PC11, all with the same results.

JGagnon_2-1727191653584.png

Here is the cube programmer log :

 

 

11:27:22:739 : Serial Port ttyUSB0 is successfully opened.
  11:27:22:739 : Port configuration: parity = even, baudrate = 9600, data-bit = 8,                     stop-bit = 1.0, flow-control = off
  11:27:22:739 : No Init bits value is : 0 
  11:27:22:739 : Sending init command: 
  11:27:22:739 : #byte 0x7F sent successfully to target
  11:27:24:742 : Wait ends after 1 loop, dataready = 0, delay = 2002
  11:27:24:742 : Timeout error occured while waiting for acknowledgement.
  11:27:24:742 : No response from target received
  11:27:24:742 : Retrying UART init connection...
  11:27:24:742 : #byte 0x7F sent successfully to target
  11:27:24:842 : Wait ends after 1 loop, dataready = 0, delay = 100
  11:27:24:842 : Timeout error occured while waiting for acknowledgement.
  11:27:24:842 : No response from target received
  11:27:24:842 : Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again... 
  11:27:24:848 :  UART PORT CLOSE 

 

 

and the UART Port configuration on CubeProgrammer :

JGagnon_3-1727191940912.png

When connecting to the chip through cube programmer, I can see that the BFB2 bit (dual bank boot) is disabled.

JGagnon_4-1727191977872.png

 

I am at loss on how to proceed to make this work. I searched the STM32 forums and internet for days, without success to access the UART Bootloader.

Any help would be appreciated.

Thanks




1 ACCEPTED SOLUTION

Accepted Solutions

I tried my setup with a NUCLEO-G070RB, with the same bootloader code since they have the same system memory address and I was able to connect through the UART with the system bootloader.

So I went back to the NUCLEO-F439 and tried again and I was able to connect through UART on the system memory.

The issue is that when the board is first powered, the UART bootloader does not work. I also noticed that if I plug the usb cable on the otg port after the board has been powered, I cannot connect with it. I need to plug the usb first in, and then power-on the board.

So my guess is that on the power-up, something is picked up on a line that can trigger the bootloader and that cause an issue. I don't have an oscilloscope with me to test that hypothesis though.

When I reboot through the user button, then I can do USB or UART.

I was always power-cycling because I wanted to simulate how the project would work : no user button for the reset, only a power cycle or a reset instruction in the code can reset the mcu. That's why I never picked-up the issue.

So that's that.

Thanks for the help.

View solution in original post

6 REPLIES 6
TDK
Guru

Make sure USB is not connected when you are trying to connect over UART. The bootloader will connect to the first device it sees.

If you feel a post has answered your question, please click "Accept as Solution".
MM..1
Chief II

Primary check with normal boot pattern BOOT0 pin and USART connect. After this work use jumping.

Sure is FTDI TX connected to STM RX ?

The USB is not connected when I try to enter into boot loader mode. I also tried completely disabling USB, but I don't think it matters since the system bootloader has its own code.

It does not work. But I know for a fact that I am in the system bootloader since I am able to use the DFU with the code posted in the original post

 

You're trying the right things. Must be missing something.

Can you show a picture of your connections? Is GND connected between your UART translator and the board? Should also be able to debug the chip and verify it's in the system bootloader code before sending the 0x7F (around 0x1FFFxxxx).

If you feel a post has answered your question, please click "Accept as Solution".

I tried my setup with a NUCLEO-G070RB, with the same bootloader code since they have the same system memory address and I was able to connect through the UART with the system bootloader.

So I went back to the NUCLEO-F439 and tried again and I was able to connect through UART on the system memory.

The issue is that when the board is first powered, the UART bootloader does not work. I also noticed that if I plug the usb cable on the otg port after the board has been powered, I cannot connect with it. I need to plug the usb first in, and then power-on the board.

So my guess is that on the power-up, something is picked up on a line that can trigger the bootloader and that cause an issue. I don't have an oscilloscope with me to test that hypothesis though.

When I reboot through the user button, then I can do USB or UART.

I was always power-cycling because I wanted to simulate how the project would work : no user button for the reset, only a power cycle or a reset instruction in the code can reset the mcu. That's why I never picked-up the issue.

So that's that.

Thanks for the help.