cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L152 Bootloader Extended Erase Failure

CVoro
Associate II

Using our internally developed tool for writing a binary to a target using the in-ROM Bootloader according to AN3155 and AN2606, we were unable to appropriately perform commands as described in both application notes, specifically Bootloader Extended Erase. The log below provides information considering bytes read and written and according results read back from the bootloader interface.

[*] Connecting to bootloader...
Read 0
Write 7f
Read 79
Write 0
Write ff
Read 79
Read b
Read 31
Read 0
Read 1
Read 2
Read 11
Read 21
Read 31
Read 44
Read 63
Read 73
Read 82
Read 92
Read 79
[*] Remote bootloader version: 3.1
Write 2
Write fd
Read 79
Read 1
Read 4
Read 29
Read 79
[*] Chip ID: 0429
[*] Performing Write Unprotect
Write 73
Write 8c
Read 79
Read 79
Connecting to bootloader...
Read 0
Write 7f
Read 79
[+] Write Protect OK
[*] Performing Read Unprotect
Write 92
Write 6d
Read 79
Read 79
Connecting to bootloader...
Read 0
Write 7f
Read 79
[+] Read Unprotect OK
[*] Performing Extended Erase.
Write 44
Write bb
Read 79
Write ff
Write ff
Write 0
Read 1f
[-] Extended Erase ERR, falling back...
Write 43
Write bc
Read 1f
[-] Erase ERR
[*] Downloading Binary
Write 31
Write ce
Read 79
Write 1f
Write f0
Write 0
Write 0
Write ef
Read 1f
[-] Download error

The interesting part may be found in line 41, where flash read unprotect command is executed, which results in defined behavior. What I fail to understand is, why Extended Erase command, initiated by write 0x44 0xbb, followed by the type of special erase (0xffff) for Full Erase and an according checksum of 0xFF^0xFF = 0x00, is aborted as Code Readout Protection has been previously disabled. Furthermore, in Code Download Stage, requesting a write with a valid address is omitted by the microcontroller with 0x1F as well.

Please kindly note that the microcontroller used in this application is STM32L152Cx.

Thank you in advance.

Edit 1:

Please kindly note that Chip is in Write Protect Level 0, meaning that it has not been permanently read / write-disabled.

Edit 2:

I have noticed that after line 64, I am trying to flash sectors outside of system memory. I have fixed the issue. However, the other one, failure on full erasure, still remains.

Thank you in advance.

Edit 3:

Using the official STM32 Flasher Demo (for Windows only, sadly) I get same result, ERASE operation results in error.

2 REPLIES 2
CVoro
Associate II

Please kindly note that Chip is in Write Protect Level 0, meaning that it has not been permanently read / write-disabled.

CVoro
Associate II

I have noticed that after line 64, I am trying to flash sectors outside of system memory. I have fixed the issue. However, the other one, failure on full erasure, still remains.

Thank you in advance.