cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 bootloader write problem with L031 nucleo board

ZNoce.1
Associate

So i am writing an application to communicate with STM32 internal bootloader.

Everything works fine except writing to flash of L031 nucleo board (it works with F303 nucleo board).

It even works normally if my writes are page aligned.

Ok so problem is when i try to write more than 256 bytes starting with address 0x08000008. It writes 256 bytes correctly but next few bytes are not written. This can be seen in this output (also it is weird that unwritten bytes are read as 0x00 and not 0xFF - this is OK on F303):

Bootloader version  : 0x31
Device ID           : 0x0425 
Option byte 1       : 0x00
Option byte 2       : 0x00
Read memory: 
0x08000000: 0x00 0x00 0x00 0x00
0x08000004: 0x00 0x00 0x00 0x00
0x08000008: 0x01 0x23 0x45 0x67
0x0800000C: 0x89 0xAB 0xCD 0xEF
0x08000010: 0x01 0x23 0x45 0x67
0x08000014: 0x89 0xAB 0xCD 0xEF
0x08000018: 0x01 0x23 0x45 0x67
0x0800001C: 0x89 0xAB 0xCD 0xEF
0x08000020: 0x01 0x23 0x45 0x67
0x08000024: 0x89 0xAB 0xCD 0xEF
0x08000028: 0x01 0x23 0x45 0x67
0x0800002C: 0x89 0xAB 0xCD 0xEF
0x08000030: 0x01 0x23 0x45 0x67
0x08000034: 0x89 0xAB 0xCD 0xEF
0x08000038: 0x01 0x23 0x45 0x67
0x0800003C: 0x89 0xAB 0xCD 0xEF
0x08000040: 0x01 0x23 0x45 0x67
0x08000044: 0x89 0xAB 0xCD 0xEF
0x08000048: 0x01 0x23 0x45 0x67
0x0800004C: 0x89 0xAB 0xCD 0xEF
0x08000050: 0x01 0x23 0x45 0x67
0x08000054: 0x89 0xAB 0xCD 0xEF
0x08000058: 0x01 0x23 0x45 0x67
0x0800005C: 0x89 0xAB 0xCD 0xEF
0x08000060: 0x01 0x23 0x45 0x67
0x08000064: 0x89 0xAB 0xCD 0xEF
0x08000068: 0x01 0x23 0x45 0x67
0x0800006C: 0x89 0xAB 0xCD 0xEF
0x08000070: 0x01 0x23 0x45 0x67
0x08000074: 0x89 0xAB 0xCD 0xEF
0x08000078: 0x01 0x23 0x45 0x67
0x0800007C: 0x89 0xAB 0xCD 0xEF
0x08000080: 0x01 0x23 0x45 0x67
0x08000084: 0x89 0xAB 0xCD 0xEF
0x08000088: 0x01 0x23 0x45 0x67
0x0800008C: 0x89 0xAB 0xCD 0xEF
0x08000090: 0x01 0x23 0x45 0x67
0x08000094: 0x89 0xAB 0xCD 0xEF
0x08000098: 0x01 0x23 0x45 0x67
0x0800009C: 0x89 0xAB 0xCD 0xEF
0x080000A0: 0x01 0x23 0x45 0x67
0x080000A4: 0x89 0xAB 0xCD 0xEF
0x080000A8: 0x01 0x23 0x45 0x67
0x080000AC: 0x89 0xAB 0xCD 0xEF
0x080000B0: 0x01 0x23 0x45 0x67
0x080000B4: 0x89 0xAB 0xCD 0xEF
0x080000B8: 0x01 0x23 0x45 0x67
0x080000BC: 0x89 0xAB 0xCD 0xEF
0x080000C0: 0x01 0x23 0x45 0x67
0x080000C4: 0x89 0xAB 0xCD 0xEF
0x080000C8: 0x01 0x23 0x45 0x67
0x080000CC: 0x89 0xAB 0xCD 0xEF
0x080000D0: 0x01 0x23 0x45 0x67
0x080000D4: 0x89 0xAB 0xCD 0xEF
0x080000D8: 0x01 0x23 0x45 0x67
0x080000DC: 0x89 0xAB 0xCD 0xEF
0x080000E0: 0x01 0x23 0x45 0x67
0x080000E4: 0x89 0xAB 0xCD 0xEF
0x080000E8: 0x01 0x23 0x45 0x67
0x080000EC: 0x89 0xAB 0xCD 0xEF
0x080000F0: 0x01 0x23 0x45 0x67
0x080000F4: 0x89 0xAB 0xCD 0xEF
0x080000F8: 0x01 0x23 0x45 0x67
0x080000FC: 0x89 0xAB 0xCD 0xEF
0x08000100: 0x01 0x23 0x45 0x67
0x08000104: 0x89 0xAB 0xCD 0xEF
0x08000108: 0x00 0x00 0x00 0x00
0x0800010C: 0x00 0x00 0x00 0x00
0x08000110: 0x00 0x00 0x00 0x00
0x08000114: 0x00 0x00 0x00 0x00
0x08000118: 0x00 0x00 0x00 0x00
0x0800011C: 0x00 0x00 0x00 0x00
0x08000120: 0x00 0x00 0x00 0x00
0x08000124: 0x00 0x00 0x00 0x00
0x08000128: 0x00 0x00 0x00 0x00
0x0800012C: 0x00 0x00 0x00 0x00
0x08000130: 0x00 0x00 0x00 0x00
0x08000134: 0x00 0x00 0x00 0x00
0x08000138: 0x00 0x00 0x00 0x00
0x0800013C: 0x00 0x00 0x00 0x00
0x08000140: 0x01 0x23 0x45 0x67
0x08000144: 0x89 0xAB 0xCD 0xEF
0x08000148: 0x01 0x23 0x45 0x67
0x0800014C: 0x89 0xAB 0xCD 0xEF
0x08000150: 0x01 0x23 0x45 0x67
0x08000154: 0x89 0xAB 0xCD 0xEF
0x08000158: 0x01 0x23 0x45 0x67
0x0800015C: 0x89 0xAB 0xCD 0xEF
0x08000160: 0x01 0x23 0x45 0x67
0x08000164: 0x89 0xAB 0xCD 0xEF
0x08000168: 0x01 0x23 0x45 0x67
0x0800016C: 0x89 0xAB 0xCD 0xEF
0x08000170: 0x01 0x23 0x45 0x67
0x08000174: 0x89 0xAB 0xCD 0xEF
0x08000178: 0x01 0x23 0x45 0x67
0x0800017C: 0x89 0xAB 0xCD 0xEF
0x08000180: 0x01 0x23 0x45 0x67
0x08000184: 0x89 0xAB 0xCD 0xEF
0x08000188: 0x01 0x23 0x45 0x67
0x0800018C: 0x89 0xAB 0xCD 0xEF
0x08000190: 0x01 0x23 0x45 0x67
0x08000194: 0x89 0xAB 0xCD 0xEF
0x08000198: 0x01 0x23 0x45 0x67
0x0800019C: 0x89 0xAB 0xCD 0xEF
0x080001A0: 0x01 0x23 0x45 0x67
0x080001A4: 0x89 0xAB 0xCD 0xEF
0x080001A8: 0x01 0x23 0x45 0x67
0x080001AC: 0x89 0xAB 0xCD 0xEF
0x080001B0: 0x01 0x23 0x45 0x67
0x080001B4: 0x89 0xAB 0xCD 0xEF
0x080001B8: 0x01 0x23 0x45 0x67
0x080001BC: 0x89 0xAB 0xCD 0xEF
0x080001C0: 0x01 0x23 0x45 0x67
0x080001C4: 0x89 0xAB 0xCD 0xEF
0x080001C8: 0x01 0x23 0x45 0x67
0x080001CC: 0x89 0xAB 0xCD 0xEF
0x080001D0: 0x01 0x23 0x45 0x67
0x080001D4: 0x89 0xAB 0xCD 0xEF
0x080001D8: 0x01 0x23 0x45 0x67
0x080001DC: 0x89 0xAB 0xCD 0xEF
0x080001E0: 0x01 0x23 0x45 0x67
0x080001E4: 0x89 0xAB 0xCD 0xEF
0x080001E8: 0x01 0x23 0x45 0x67
0x080001EC: 0x89 0xAB 0xCD 0xEF
0x080001F0: 0x01 0x23 0x45 0x67
0x080001F4: 0x89 0xAB 0xCD 0xEF
0x080001F8: 0x01 0x23 0x45 0x67
0x080001FC: 0x89 0xAB 0xCD 0xEF
0x08000200: 0x01 0x23 0x45 0x67
0x08000204: 0x89 0xAB 0xCD 0xEF

My guess is that the problem is when writing second time to freshly erased page. First time it writes 8 bytes and second time it tries to write other bytes but bootloader won't let it. But it is weird as it looks that only half of page is locked. I tried the same with F303 board but there is no problem and also unwritten bytes are read as 0xFF (and not 0x00 as with L031 nucleo, they have the same bootloader version 0x31).

Bootloader version  : 0x31
Device ID           : 0x0438 
Option byte 1       : 0x00
Option byte 2       : 0x00
Read memory: 
0x08000000: 0xFF 0xFF 0xFF 0xFF
0x08000004: 0xFF 0xFF 0xFF 0xFF
0x08000008: 0x01 0x23 0x45 0x67
0x0800000C: 0x89 0xAB 0xCD 0xEF
0x08000010: 0x01 0x23 0x45 0x67
0x08000014: 0x89 0xAB 0xCD 0xEF
0x08000018: 0x01 0x23 0x45 0x67
0x0800001C: 0x89 0xAB 0xCD 0xEF
0x08000020: 0x01 0x23 0x45 0x67
0x08000024: 0x89 0xAB 0xCD 0xEF
0x08000028: 0x01 0x23 0x45 0x67
....

0 REPLIES 0