UART peripheral

The MCU bootloader integrates an autobaud detection algorithm for the UART peripheral, thereby providing flexible baud rate choices.

Autobaud feature: If UARTn is used to connect to the bootloader, then the UARTn_RX pin must be kept high and not left floating during the detection phase in order to comply with the autobaud detection algorithm. After the bootloader detects the ping packet (0x5A 0xA6) on UARTn_RX, the bootloader firmware executes the autobaud sequence. If the baudrate is successfully detected, then the bootloader sends a ping packet response [(0x5A 0xA7), protocol version (4 bytes), protocol version options (2 bytes), and crc16 (2 bytes)] at the detected baudrate. The MCU bootloader then enters a loop, waiting for bootloader commands via the UART peripheral.

Note: The data bytes of the ping packet must be sent continuously (with no more than 80 ms between bytes) in a fixed UART transmission mode (8-bit data, no parity bit, and 1 stop bit). If the bytes of the ping packet are sent one-by-one with more than an 80 ms delay between them, then the autobaud detection algorithm may calculate an incorrect baud rate. In this instance, the autobaud detection state machine should be reset.

Supported baud rates: The baud rate is closely related to the MCU core and system clock frequencies. Typical baud rates supported are 9600, 19200, 38400, and 57600. Of course, to influence the performance of autobaud detection, the clock configuration in BCA can be changed.

Packet transfer: After autobaud detection succeeds, bootloader communications can take place over the UART peripheral. The following flow charts show:

  • How the host detects an ACK from the target

  • How the host detects a ping response from the target

  • How the host detects a command response from the target

Host reads an ACK from target via UART

Host reads a ping response from target via UART

Host reads a command response from target via UART

Performance Numbers for UART

The table below provides reference to the expected performance of write speeds to Flash and RAM memories using the MCU bootloader SPI interface. The numbers have been measured on a number of platforms running the MCU bootloader either from ROM or the RAM (in case of flashloaders).

Performance numbers for UART

UART Baud Rate

Flash Average Writing Speed (KB/s)

Ram Average Writing Speed (KB/s)

KL27

KL28

KL43

KL80

K80

KL03

KS22

KL27

KL28

KL43

KL80

K80

KL03

KS22

19200

1.47

1.47

1.43

1.47

1.46

1.43

1.45

1.51

1.52

1.48

1.52

1.52

1.49

1.51

38400

2.81

2.82

2.75

2.82

2.79

2.81

2.75

2.99

3.03

2.95

3.03

3.03

2.9

3.00

57600

4.07

4.07

3.97

4.08

4.01

-

3.93

4.46

4.53

4.4

4.54

4.51

-

4.47

115200

7.3

7.31

7.12

7.35

7.1

-

6.88

8.69

8.97

8.65

8.98

8.85

-

8.73

230400

12.14

-

11.83

12.27

11.42

-

11.01

16.57

-

16.77

17.58

16.73

-

16.65

Default core Frequency (MHz)

48

48

48

48

48

8

48

48

48

48

48

48

8

48

Default bus Frequency (MHz)

24

24

24

24

24

4

24

24

24

24

24

24

4

24

Note:

  1. Every test covers all flash or RAM region with 0x0 - 0xf.

  2. Run every test three times and calculate the average.

Flash Average Writing Speed

RAM Average Writing Speed

Parent topic:UART peripheral

Parent topic:Supported peripherals