forked from espressif/esp-idf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(i2c_master): Do not busy wait on sync transactions
This commit introduces a private member `i2c_master_bus_t::in_progress_semphr` which allows `i2c_master_transmit` and related functions to give up their timeslice so other tasks can proceed. Without this commit, one must delay at least one tick via `vTaskDelay(1)` to prevent trigging the idle watchdog, thus limiting the maximum I2C transaction rate to about the speed of `CONFIG_FREERTOS_HZ`. With this commit, over 6600 samples/sec are possible and the tick delay is unnecessary. CPU usage below was measured using `vTaskGetRunTimeStats()`. The FreeRTOS %CPU numbers seem to increase over time and level out after a time, so CPU usage was sampled after 5 seconds across each test for consistency across measurements. Measurements were taken with `CONFIG_FREERTOS_HZ` set to 100Hz and 1000Hz: Before: 100Hz: samples/sec= 99 with 1% CPU ( 99.0 samples/%cpu) 1000Hz: samples/sec= 995 with 10% CPU ( 99.5 samples/%cpu) After: 100Hz: samples/sec=6637 with 23% CPU (288.6 samples/%cpu) 1000Hz: samples/sec=6610 with 24% CPU (275.4 samples/%cpu) Closes: espressif#13137 Signed-off-by: Eric Wheeler <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters