I2C peripheral
The MCU bootloader supports loading data into flash via the I2C peripheral, where the I2C peripheral serves as the I2C slave. A 7-bit slave address is used during the transfer.
Customizing an I2C slave address is also supported. This feature is enabled if the Bootloader Configuration Area (BCA) is enabled (tag field is filled with ‘kcfg’) and the i2cSlaveAddress field is filled with a value other than 0xFF. Otherwise, 0x10 is used as the default I2C slave address.
The MCU bootloader uses 0x10 as the I2C slave address, and supports 400 kbit/s as the I2C baud rate.
The maximum supported I2C baud rate depends on corresponding clock configuration field in the BCA. The typical baud rate is 400 kbit/s with factory settings. The actual supported baud rate may be lower or higher than 400 kbit/s, depending on the actual value of the clockFlags and the clockDivider fields.
Because the I2C peripheral serves as an I2C slave device, each transfer should be started by the host, and each outgoing packet should be fetched by the host.
An incoming packet is sent by the host with a selected I2C slave address and the direction bit is set as write.
An outgoing packet is read by the host with a selected I2C slave address and the direction bit is set as read.
0x00 is sent as the response to host if the target is busy with processing or preparing data.
The following charts show the communication flow of the host reading the ping and ACK packets, and the corresponding responses from the target.
Host reads ping response from target via I2C
Host reads ACK packet from target via I2C
|
Host reads response from target via I2C
Performance numbers for I2C
The table below provides reference to the expected performance of write speeds to Flash and RAM memories using the MCU bootloader I2C interface. The numbers have been measured on a number of platforms running the MCU bootloader from either ROM or RAM (for flashloaders).
Performance numbers for I2C
I2C Bus Freque ncy (KHz) |
Flash Average Writing Speed (KB/s) |
Ram Average Writing Speed (KB/s) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
KL27 |
KL28 |
KL43 |
KL80 |
K80 |
KL03 |
KL27 |
KL28 |
KL43 |
KL80 |
K80 |
KL03 |
|
100 |
6.42 |
6.29 |
6.42 |
6.7 |
6.39 |
6.08 |
7.67 |
7.27 |
7.7 |
7.91 |
7.38 |
6.13 |
200 |
10.24 |
10.08 |
10.13 |
10.58 |
9.82 |
8.75 |
14.02 |
13.25 |
13.78 |
14.15 |
13.43 |
10.1 |
300 |
12.86 |
11.84 |
11.95 |
13.11 |
11.85 |
9.69 |
18.04 |
17.51 |
17.92 |
18.98 |
17.61 |
11.9 |
400 |
15.54 |
14.06 |
14.39 |
14.74 |
13.44 |
10.24 |
23.2 |
22.39 |
21.82 |
24.19 |
22.04 |
12.82 |
500 |
15.86 |
16.13 |
15.96 |
16.94 |
14.65 |
- |
24.61 |
27.9 |
26.5 |
30.26 |
26.93 |
- |
600 |
18.14 |
16.51 |
16.4 |
17.19 |
15.19 |
- |
29.44 |
28.64 |
27.05 |
30.96 |
27.57 |
- |
800 |
19.5 |
- |
18.51 |
19.22 |
16.26 |
- |
34.44 |
- |
33.38 |
38.36 |
32.72 |
- |
1000 |
20.48 |
- |
20.03 |
21.35 |
17.71 |
- |
37.64 |
- |
41.04 |
45.38 |
33.65 |
- |
Default core Freque ncy (MHz) |
48 |
48 |
48 |
48 |
48 |
8 |
48 |
48 |
48 |
48 |
48 |
8 |
Default bus Freque ncy (MHz) |
24 |
24 |
24 |
24 |
24 |
4 |
24 |
24 |
24 |
24 |
24 |
4 |
Note: |
Every test covers all flash or RAM regions with 0x0 - 0xf.
Run every test three times and calculate the average.
Flash Average Writing Speed
RAM Average Writing Speed
Parent topic:I2C peripheral
Parent topic:Supported peripherals