cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F100C8T6B Bootloader issues

davidveldhuizen9
Associate
Posted on December 03, 2012 at 20:42

I am trying to talk to the bootloader in the STM32F100 and having some issues.

I can successfully send the 0x7F and get back a 0x79 ACK.

Next when i send a Get Command i don't get any response. I am sending two bytes to the micro (0x00 and 0xFF), but get no response.

When i send the Get Command again, I get back a NAK. (0x1F).

Is the Get command supported by this processor?

-David

#stm32-uart-bootloader-parity
6 REPLIES 6
Posted on December 03, 2012 at 21:38

I would expect it to work, along with { 0x01, 0xFE } and { 0x02, 0xFD }

Make sure you're using 8-bit Even Parity, try at lower baud rates.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
davidveldhuizen9
Associate
Posted on December 03, 2012 at 22:16

I am stumped because I got this working with a ST32 400 Series processor.

I have changed the baud rate from 11500 down to 9600 and it makes no difference.

I have also tried Get Version and Get ID commands and have the same issues.

-David

harry_rostovtsev
Associate II
Posted on March 29, 2013 at 16:41

I'm having exactly the same problem with stm32f103 processor. 

I send: 0x7F

I get:    0x79

I send 0x00 and before I even get a chance to send the 0xFF,

I get:    0x1F

Same with 0x01 0xFE and 0x02 0xFD commands.

Just to verify, when I send over the 2 byte commands, I send the 0x00 first and then the complement, correct?

Also worth noting: I was using Parity_None on the connecting device (another STM32 device).  When I was configuring my USART with no parity, it was at least connecting and I was getting back an ACK to 0x7F.  When I changed the settings to even parity as Clive (and the app note) suggest, I got a 0x00 in reply to connection requests.

Posted on March 29, 2013 at 16:54

Can you be a bit more specific about how you have the serial connection configured?

The 0x7F trick only works at reset, if subsequent characters are not received correctly, or if the baud rate is off, it may not respond correctly. You get a readable response, so I'd guess the baud rate is reasonable.

Make sure to be using even parity.

Use a terminal or app that can send both characters as a pair, the loader has a watchdog but I don't recall the time out on it. Something like RealTerm can send hex strings quite easily, and caches sequences.

The pairing is typically the command and it's logical inverse, some more complicated commands have checksums.

If it rejects the first byte, sending the subsequent one won't help.

Does the Flash Loader Demonstrator work in your system? If that doesn't function I'd be looking at the hardware circuit more carefully, and trying some other serial ports.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
harry_rostovtsev
Associate II
Posted on March 29, 2013 at 23:34

My setup is as follows:

STM32F2 is the host and there is a slave board with an STM32F103 hooked up to it with F2 having control over the F1's BOOT0 and RESET lines. STM32F2 -> USART2 ------------------------ USART1<-STM32F1 I have a very simple program that blinks the LED on the F1 so I can tell if I'm in regular FLASH boot mode or in system memory boot mode. I can get the F1 into system boot mode and it will respond to 0x7F (depending on serial settings) but I can't seem to get it to go past this point. ''Can you be a bit more specific about how you have the serial connection configured?'' So I've gone through several different settings on the host: This is the setting that is recommended in AN3155 (as far as I can tell):

USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_Even;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

and it doesn't work. I send: 0x7F I get back: 0x00 0x00 0x00 (receive is via interrupt so I actually get 3 zeroes). If I remove the ''even'' parity and set it to ''no'' or ''odd'', I get the following

USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

and it doesn't work. I send: 0x7F I get back: 0x79 (Yay, connected!) I send: 0x00, 0xFF I get back: 0x79 0x0b 0x43 ... and that's it. No supported commands, no terminating ACK. Same if I try other commands. I get the first byte or 3 but nothing past that. I I started experimenting: word len = 9b, even parity

USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_9b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_Even;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

Same result as with 8b and no parity. Word len = 9b, No parity Same result as above. What's the deal? Am I totally off base as far as my UART settings are concerned?
franz2
Associate III
Posted on November 10, 2015 at 14:52

Dear all

Probably I have same problem like rost0031

My hardware:

CPU 1 Master: STM32F072R8T6TR

CPU 2 Slave: STM32F030K6

I want to update CPU 2 with the built in bootloader mode with CPU 1. CPU1 has control over Boot0 and Reset Pin of CPU2. CPU2 use USART1 (PA9, PA10), CPU 2 use USART 4 (PC10/11)

Here what I found out:

If I use no parity, then the system is working more or less. With even parity I don’t get replay from CPU2:

Here the result with no parity:

Init of CPU 1:

#define CPU_COMM_PORT           USART4

    USART_InitStructure.USART_BaudRate = 38400;

    USART_InitStructure.USART_WordLength = USART_WordLength_8b;

    USART_InitStructure.USART_StopBits = USART_StopBits_1;

    USART_InitStructure.USART_Parity = USART_Parity_No; 

    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

    USART_Init(CPU_COMM_PORT, &USART_InitStructure); //USARTx configuration

    USART_Cmd(CPU_COMM_PORT, ENABLE);  //Enable USARTx   

Result with no parity:

Baudrate ok. I receive 0x79 (ACK)

Get Command: I send 0x00, 0xFF

Receive ACK, 0x0B, 0x31 0x00 0x01 0x02 0x11 0x21 0x31 0x44 0x63 0x73 0x82 0x92 0x79 (ACK)

Problem: If I send 2 bytes without time delay of around 1ms, the get command don’t work.

If I set the UART setting according documentation AN3155:

Init of CPU 1:

#define CPU_COMM_PORT           USART4

    USART_InitStructure.USART_BaudRate = 38400;

    USART_InitStructure.USART_WordLength = USART_WordLength_8b;

    USART_InitStructure.USART_StopBits = USART_StopBits_1;

    USART_InitStructure.USART_Parity = USART_Parity_Even; 

    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

    USART_Init(CPU_COMM_PORT, &USART_InitStructure); //USARTx configuration

    USART_Cmd(CPU_COMM_PORT, ENABLE);  //Enable USARTx   

Result with even parity:

CPU2 never answer. (I only changed parity setting)

I also tried 9 Bit Data with even parity. (Like other writer)

Init of CPU 1:

#define CPU_COMM_PORT           USART4

    USART_InitStructure.USART_BaudRate = 38400;

    USART_InitStructure.USART_WordLength = USART_WordLength_9b;

    USART_InitStructure.USART_StopBits = USART_StopBits_1;

    USART_InitStructure.USART_Parity = USART_Parity_Even; 

    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

    USART_Init(CPU_COMM_PORT, &USART_InitStructure); //USARTx configuration

    USART_Cmd(CPU_COMM_PORT, ENABLE);  //Enable USARTx   

Result with even parity:

Baudrate ok. I receive 0x179 (0x079 is ACK)

If I filter this 9. Bit it works equal to the version with 8 Bit and no parity.

So I also can read back the ‘get command’ information from CPU2.

I tried:

Baudrate from 1200 – 115000 Bits/s.

Different waiting times. (CPU1 set CPU2 over Boot0 Pin and Reset into download mode)