Showing results for 
Search instead for 
Did you mean: 

Time out when reading or writing on memory using the Bootloader over UART - Nucleo L476RG

Associate II

Dear community, 

I have been fighting against the Bootloader for a time now. 
I manage to initiate it, using GET commands and the read unprotect command. But when it comes to reading or writing, I just get a timeout, no NACK or anything. 

I don't know what is wrong with my code, and I cannot find an example of working c code. I already checked the application notes. 

The setup is the following: 
- Board1 L476RG in Bootloader mode (Patter 7)

- Board 2 L4P5ZG running the program in c to enter into the Board1 memory. 

I connected Tx-Rx and Rx-Tx plus the GND. 

Uart configuration: 

  huart1.Instance = USART1;

  huart1.Init.BaudRate = 9600;

  huart1.Init.WordLength = UART_WORDLENGTH_9B;

  huart1.Init.StopBits = UART_STOPBITS_1;

  huart1.Init.Parity = UART_PARITY_EVEN;

This is the output of the terminal: 


ACK... Ready

Response: 0x79

Response: 0x79

 Sending command ...


Response: 0x79

Response: 0x0B

Response: 0x31

Response: 0x00

Response: 0x01

Response: 0x02

Response: 0x11

Response: 0x21

Response: 0x31

Response: 0x44

Response: 0x63

Response: 0x73

Response: 0x82

Response: 0x92

Response: 0x79

Get version - status: 1 


Response: 0x79

Response: 0x79

Read unprotect 1 

UART Receive Status: 3

Response: 0x00

Response: 0x00


I attach the code, it is divided into a boot_util class with the functions and the main code that is activated by a button. 

I would be grateful if someone could help me because I have been stuck now with this issue for many weeks and I cannot understand the error. 

Thank you!