cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 bootloader write

ralf239955_st
Associate II
Posted on February 11, 2013 at 08:52

Hi all,

up to now I  used a MSWindows bootloader application (based on Dale Wheats code) for the STM32F1. Now I also use the STM32F4. I updated the bootloader due to the different erase commands (erase vs. extended erase). Now I can identify and erase the STM32. But if I want to write to the flash by issuing the 'Write Memory Command' (0x31) I always get back NACK. Read/write protection is disabled.

It would be great I someone could point me in the right direction.

Best regards

Tom  

#stm32f4-bootloader
12 REPLIES 12
Posted on February 11, 2013 at 13:13

Does a read to the same location work, and is the space erased?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ralf239955_st
Associate II
Posted on February 11, 2013 at 15:04

Hi,

I checked a read operation (0x11) on the same address instead of writing. It also failed. Erasing the flash, does'nt matter if complete erase or only a partial erase, is working. So there should be also no write protection on the flash.

The erase command returns a final ACK. So I suppose that the flash is really erased.

Best regards

Tom

Posted on February 11, 2013 at 17:31

Here's a STM32F4-Discovery in USART3 System Loader mode, seems to read fine

USART3 RealTerm Hex Mode
S:0x7F
R:79
S:0x00,0xFF
R:79 0B 31 00 01 02 11 21 31 44 63 73 82 92 79 
S:0x01,0xFE
R:79 31 00 00 79
S:0x11,0xEE
R:79
S:0x08,0x00,0x00,0x00,0x08 ; 0x08000000, chksum 0x08
R:79
S:0xFF,0x00
R:79 28 04 00 20 9D 01 00 08 A1 02 00 08 9D 02 00 08 
9F 02 00 08 F5 01 00 08 01 06 00 08 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 E5 03 00 08 F7 01 00 08 00 00 00 00 2D 03 00 08 A9 04 00 08 
C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 
F9 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 
C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 
C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 
C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 45 05 00 08 C3 01 00 08 
C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 
C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 
2B 03 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 
S:0x11,0xEE,0x08,0x00,0x01,0x00,0x09,0xFF,0x00 ; 0x08000100
R:79 79 79 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 
01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 
01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 
01 00 08 C3 01 00 08 29 03 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 
01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 
01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 C3 01 00 08 DF F8 0C D0 00 
F0 20 F8 00 48 00 47 21 06 00 08 28 04 00 20 09 48 01 68 41 F4 70 01 01 
60 08 48 80 47 08 48 00 47 00 00 FE E7 FE E7 FE E7 FE E7 FE E7 FE E7 FE 
E7 FE E7 FE E7 FE E7 88 ED 00 E0 AD 04 00 08 89 01 00 08 06 4C 07 4D 06 
E0 E0 68 40 F0 01 03 94 E8 07 00 98 47 10 34 AC 42 F6 D3 FF F7 D2 FF 60 
06 00 08 80 06 00 08 FE E7 70 47 70 47 F0 B5 00 23 01 24
S:0x44,0xBB ; ERASE EXTENDED
R:79
S:0xFF,0xFF,0x00 ; MASS ERASE
R:79

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 11, 2013 at 17:39

Writing, after a restart. Might want to check if you need to flush ART cache

S:0x31,0xCE ; WRITE
R:79
S:0x08,0x00,0x00,0x00,0x08 ; 0x08000000
R:79
S:0x0F,0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF,0x0F ; x10 PATTERN
R:79
S:0x11,0xEE,0x08,0x00,0x00,0x00,0x08,0x0F,0xF0 ; READ 0x08000000 x10
R:79 79 79 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
S:0x11,0xEE,0x08,0x00,0x00,0x10,0x18,0x0F,0xF0 ; READ 0x08000010 x10
R:79 79 79 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
f3434
Associate II
Posted on July 02, 2013 at 22:35

Hi, Tom. Did you solve your problem? 

Posted on July 03, 2013 at 00:07

At 4-5 months out, 4 total posts, and no email alerting the odds of getting a response are pretty slim.

Please just state your problem, describe what you're doing, what you've tested so far.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
f3434
Associate II
Posted on July 03, 2013 at 20:02

Hi, 0690X0000060Mm5QAE.gif.

I've connected to the stm32f4 discovery in CAN2-Bootmode.

I've successfully sent requests 0x00, 0x01, 0x

But when i sent read request (0x11), controller returned 0x1F - error.

I don't understand what is wrong..

Posted on July 03, 2013 at 20:30

Can't say I've tried using CAN to do this.

Make sure the address you send is in big-endian format, the address range is checked for validity. Can you provide some sample packets which are being rejected?

Try doing a read of 0x08000008

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
f3434
Associate II
Posted on July 04, 2013 at 22:23

Thank you for responce, i try..