cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer erase a strange address when i use a custom bootloader and usb DFU

Dongsik
Associate II

Hi,

I have been trying to make a custom bootloader for STM32F413.

I use STM32CubeProgrammer, USB DFU

Although​ I have succeeded to make a custom bootloader for another MCU (STM32F412), it's first time that STM32CubeProgrammer erase an unexpected address.

I just wanted to use 0x0804 0000 as start address of application.

0693W00000GZjEMQA1.png

But, STM32CubeProgrammer ​implemented like the log below

10:01:21:342 : Opening and parsing file: 
10:01:21:345 :   File          : 
10:01:21:345 :   Size          : 654340 Bytes
10:01:21:345 :   Address       : 0x08040000 
10:01:21:345 : Erasing Segment <0> Address <0x08040000> Size <654340>Bytes
10:01:21:345 : Erasing memory corresponding to segment 0:
10:01:21:346 : DFU status = 0
10:01:21:346 : DFU State = 5
10:01:21:346 : Status: 0, State: 5
10:01:21:346 : sending a page erase request @: 0x08024000
10:01:21:357 : DFU status = 0
10:01:21:358 : DFU State = 4
10:01:21:404 : DFU status = 0
10:01:21:405 : DFU State = 5
10:01:21:405 : erasing sector 0006 @: 0x08024000 done
10:01:21:405 : DFU status = 0
10:01:21:405 : DFU State = 5
10:01:21:405 : Status: 0, State: 5
10:01:21:405 : sending a page erase request @: 0x08044000
10:01:22:289 : DFU status = 0
10:01:22:289 : DFU State = 4
10:01:22:338 : DFU status = 0
10:01:22:339 : DFU State = 5
10:01:22:340 : erasing sector 0007 @: 0x08044000 done

Why did programmer erase 0x0802 4000?

When I changed address to 0x0806 0000, programmer wanted to erase 0x0804 4000.

I don't know what i missed and what can I do.

Thanks in advance for any help.

1 ACCEPTED SOLUTION

Accepted Solutions
Dongsik
Associate II

Resolved...

I suspected STM32CubeProgrammer. But I realize it was just my fault, as always.

0693W00000HowbXQAR.pngAs above, CubeProgrammer use a USBD_DFU_MEDIA interface for memory mapping.

​Previous : @Internal Flash /0x08000000/04*016Ka, 01*016Ka, 01*064Kg,10*128Kg

Current : @Internal Flash /0x08000000/04*016Ka, 01*064Kg,11*128Kg

View solution in original post

3 REPLIES 3
Pavel A.
Evangelist III

Erase can start only on a sector boundary. STM32F4 has sectors of different sizes. Please check that your desired address is on a sector boundary.

Hi, Pavel A.

You are right. but I have already checked it.

I referred to the RM0430 Reference manual because i used a STM32F413ZGTx.

I even checked it using CubeProgrammer and ST-Link.

0693W00000GZreXQAT.png

So I have been thinking that STM32CubeProgrammer is confused when using USB not ST-link.​

I want to know why...

Dongsik
Associate II

Resolved...

I suspected STM32CubeProgrammer. But I realize it was just my fault, as always.

0693W00000HowbXQAR.pngAs above, CubeProgrammer use a USBD_DFU_MEDIA interface for memory mapping.

​Previous : @Internal Flash /0x08000000/04*016Ka, 01*016Ka, 01*064Kg,10*128Kg

Current : @Internal Flash /0x08000000/04*016Ka, 01*064Kg,11*128Kg