cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F303 USART bootloader: NACK for ''Go'' command?

markus2399
Associate II
Posted on July 07, 2014 at 16:20

Hi!

How can I tell the STM32F303 bootloader to run application code from flash memory? After reading AN3155, I tried the following byte sequence (''>'' indicating bytes sent to the serial interface, ''<'' bytes received from the interface):

>: 0x7f (baud rate detection)

<: 0x79 (ACK)

>: 0x21 0xde (''go'' command + checksum)

<: 0x79 (ACK)

>: 0x08 0x00 0x00 0x00 0xf7 (address + checksum)

<: 0x1f (NACK)

I don't understand why the ''go'' command fails to run code at address 0x08000000. Which command should be sent to launch application code? Does anything else need to be setup before executing the ''go'' command? Does the ''go'' command only work if flash memory was actually written to in the same bootloader session? I tried at 9.6 kbaud and 100 kbaud and got the same results for both.

Thanks & kind regards,

Markus

#stm32f303-usart-bootloader-go
8 REPLIES 8
Posted on July 07, 2014 at 16:50

Probably because the checksum is wrong? The address frame uses a simple XOR

Try

0x08 0x00 0x00 0x00 0x08 (address + checksum)

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

Thanks a lot, this solved the issue! Since the byte sequence for the ''go'' command is explicitly given as ''0x21 0xde'', I took it for granted that the XOR checksum has to be 0xff and didn't assume that other data blocks (start address) are handled differently (requiring XOR checksum 0x00). Actually the application note document AN3155 is also incorrect on this since it states that ''for each command the host sends a byte and its complement (XOR = 0x00)'' (should be 0xff here).

Kind regards,

Markus

Posted on July 08, 2014 at 16:25

I haven't read all the documentation, but the original AN2606 was relatively clear about a lot of this stuff. And it described the address checksumming in the READ command immediately prior to the GO command.

I'm not sure why they even said XOR=0x00 for the command and it's complement, as it's irrelevant, unless you think of it in terms of what it contributes to a running sum.

0690X0000060MmWQAU.gif

0690X0000060MmXQAU.gif

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gil23
Associate III
Posted on July 09, 2014 at 13:47

Hello Clive,

I have an issue with the communication of the Bootloader through an I2C in STM32F401C-Disco Kit.

The pins of the bootloader configured as BOOT0 = '1' and PB2 = '0' (That used as BOOT1).

The I2C configured as I2C1 PB6 = 'CLK' and PB7 = 'DAT'.

When I send the Slave Address '0x72' (as 7 bits) through the I2C I get 'Nack' instead of 'ACK' and the communication is aborted. (See attached diagram)

I'm Using a standard I2C protocol (100KHz or 200KHz).

Did Imiss somthing?

Thanks for your help

I haven't read all the documentation, but the original AN2606 was relatively clear about a lot of this stuff. And it described the address checksumming in the READ command immediately prior to the GO command.

I'm not sure why they even said XOR=0x00 for the command and it's complement, as it's irrelevant, unless you think of it in terms of what it contributes to a running sum.

0690X0000060MmYQAU.gif

0690X0000060MmZQAU.gif

________________

Attachments :

I2C.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0nL&d=%2Fa%2F0X0000000bdz%2FVXcZNA7ithdy_cnUOLesAOIsNTTFcqow87uyHDEEn9c&asPdf=false
Posted on July 09, 2014 at 14:20

I've had no cause to use the I2C mode.

I would suggest you try not shifting 0x72 (0xE4) in the fashion you have.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gil23
Associate III
Posted on July 09, 2014 at 14:43

Thanks for your quick answer.

Do you know where or how I can get help about the I2C mode?

I did not find documentations regarding the protocol of the I2C Bootloader.

Posted on July 09, 2014 at 14:53

A quick Google brought up this

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00072315.pdf

Depends on the type of help you're looking for, if you want to pay for it, and your relationship with local ST reps and FAEs.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gil23
Associate III
Posted on July 09, 2014 at 15:59

Thanks again Clive.

If I will find a solution, I will upload it to the forum.