EasyManua.ls Logo

ST STM32F105 series - 2 USART Bootloader; Bootloader Code Sequence; Choosing the Usartx Baud Rate; Figure 2. Bootloader for Stm32 F105 Xx and Stm32 F107 Xx with USART1;USART2

ST STM32F105 series
83 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
AN2662 USART bootloader
Doc ID 14156 Rev 1 13/83
2 USART bootloader
2.1 Bootloader code sequence
Figure 2. Bootloader for STM32F105xx and STM32F107xx with USART1/USART2
Once System memory boot mode is entered and the microcontroller has been configured as
described above, the bootloader code begins to scan the USARTx_RX line pin, waiting to
receive the 0x7F data frame: one start bit, 0x7F data bits, even parity bit and one stop bit.
The duration of this data frame is measured using the Systick timer. The count value of the
timer is then used to calculate the corresponding baud rate factor with respect to the current
system clock.
Next, the code initializes the serial interface accordingly. Using this calculated baud rate, an
acknowledge byte (0x79) is returned to the host, which signals that the STM32F105xx and
STM32F107xx is ready to receive user commands.
2.2 Choosing the USARTx baud rate
The calculation of the serial baud rate for USARTx, from the length of the first byte that is
received, is used to operate the bootloader within a wide range of baud rates. However, the
upper and lower limits have to be kept, in order to ensure proper data transfer.
For a correct data transfer from the host to the microcontroller, the maximum deviation
between the internal initialized baud rate for USARTx and the real baud rate of the host
should be below 2.5%. The deviation (f
B
, in percent) between the host baud rate and the
X&RECEIVEDON
53!24X2XPIN
7AITFORA
COMMAND
'%4CMD
ROUTINE
AI
53!24XSELECTED
!UTOBAUDRATESEQUENCE
SEND!#+BYTEDISABLE
UNUSEDPERIPHERALS
2$CMD
ROUTINE
OPTIONAL
2OUTINESFOR
LOADING
INTO2!-
'/CMD
ROUTINE
*0TO?!DDRESS
'/CMD
#OMMAND
RECEIVED
'%4CMD

Table of Contents

Other manuals for ST STM32F105 series

Related product manuals