Repository navigation
I2C async drivers #12100
Copy link
Copy link
Open
Description
It's just idea
I2C tasks which uses i2c takes too long and makes gaps in dshot frames. It's caused by sync behaviour of I2C driver. Driver send request and waits for response. It can take 200us. Each task should not take more than 70us aprox.
See COMPASS and BARO taks. I prepared demo for async I2C, it uses state machine similar to terrain. It does not wait to response. It's mush faster, so sync call i2c waste lot of CPU time.
I see two benefits.
- dshot without gaps, currently in dshot are 200us gaps caused by i2c calling
- hopefully it will be fast enought we could move some code from ITCM ram in F7 to standart RAM
As you can see it does not increase RAM and FLASH ussage much
Inav async I2c (feat)
Task list rate/hz max/us avg/us maxload avgload total/ms
0 - SYSTEM 9 18 2 0.5% 0.5% 10235
1 - PID 1968 83 60 16.8% 12.3% 4410
2 - GYRO 3937 17 10 7.1% 4.4% 1443
3 - RX 49 30 18 0.6% 0.5% 42
4 - SERIAL 99 150003 2 1485.5% 0.5% 1094
5 - BATTERY 50 11 8 0.5% 0.5% 15
6 - TEMPERATURE 100 8 0 0.5% 0.5% 3
7 - BEEPER 99 5 1 0.5% 0.5% 6
9 - COMPASS 999 5 3 0.9% 0.7% 3
10 - BARO 979 10 3 1.4% 0.7% 15
11 - ADSB 1 2 0 0.5% 0.5% 0
15 - TELEMETRY 495 18 2 1.3% 0.5% 172
18 - OSD 245 615 13 15.5% 0.8% 82
19 - CMS 49 3 0 0.5% 0.5% 1
22 - VTXCTRL 5 1 0 0.5% 0.5% 0
23 - PROGRAMMING 9 21 7 0.5% 0.5% 4
25 - AUX 99 4 2 0.5% 0.5% 7
26 - SPORT MASTER 495 2 0 0.5% 0.5% 6
27 - CRSF SENSOR 99 2 0 0.5% 0.5% 1
29 - GIMBAL 49 2 0 0.5% 0.5% 0
30 - HEADTRACKER 49 2 0 0.5% 0.5% 0
35 - DRONECAN 490 10 2 0.9% 0.5% 22
Task check function 2 0 1
Total (excluding SERIAL) 51.0% 26.9%
Memory region Used Size Region Size %age Used
FLASH: 1188 B 128 KB 0.91%
FLASH_CONFIG: 0 GB 128 KB 0.00%
FLASH1: 786023 B 1792 KB 42.83%
ITCM_RAM: 16248 B 64 KB 24.79%
DTCM_RAM: 12824 B 128 KB 9.78%
RAM: 144160 B 512 KB 27.50%
D2_RAM: 3104 B 256 KB 1.18%
MEMORY_B1: 0 GB 0 GB
[100%] Built target MATEKH743.elf
Inav sync I2c
Task list rate/hz max/us avg/us maxload avgload total/ms
0 - SYSTEM 9 13 0 0.5% 0.5% 6467
1 - PID 1996 51 36 10.6% 7.6% 1997
2 - GYRO 3952 14 9 6.0% 4.0% 939
3 - RX 49 20 10 0.5% 0.5% 18
4 - SERIAL 100 125119 1 1251.6% 0.5% 365
5 - BATTERY 49 8 6 0.5% 0.5% 8
6 - TEMPERATURE 99 6 1 0.5% 0.5% 2
7 - BEEPER 99 4 1 0.5% 0.5% 2
9 - COMPASS 9 292 290 0.7% 0.7% 81
10 - BARO 62 209 206 1.7% 1.7% 359
11 - ADSB 1 1 0 0.5% 0.5% 0
15 - TELEMETRY 500 12 0 1.1% 0.5% 78
18 - OSD 250 622 26 16.0% 1.1% 153
19 - CMS 49 2 0 0.5% 0.5% 0
22 - VTXCTRL 4 1 0 0.5% 0.5% 0
23 - PROGRAMMING 9 11 5 0.5% 0.5% 2
25 - AUX 99 3 1 0.5% 0.5% 3
26 - SPORT MASTER 500 2 1 0.6% 0.5% 4
27 - CRSF SENSOR 99 2 0 0.5% 0.5% 0
29 - GIMBAL 49 2 0 0.5% 0.5% 0
30 - HEADTRACKER 49 2 0 0.5% 0.5% 0
35 - DRONECAN 500 7 1 0.8% 0.5% 12
Task check function 2 1 0
Total (excluding SERIAL) 44.0% 23.1%
Memory region Used Size Region Size %age Used
FLASH: 1188 B 128 KB 0.91%
FLASH_CONFIG: 0 GB 128 KB 0.00%
FLASH1: 777311 B 1792 KB 42.36%
ITCM_RAM: 16248 B 64 KB 24.79%
DTCM_RAM: 12824 B 128 KB 9.78%
RAM: 140 KB 512 KB 27.34%
D2_RAM: 3104 B 256 KB 1.18%
MEMORY_B1: 0 GB 0 GB
[100%] Built target MATEKH743.elf
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity