Skip to content

Commit

Permalink
Limit I2C to 400kHz on ESP32-H2. SSD1306 benchmarks for H2 and C6
Browse files Browse the repository at this point in the history
  • Loading branch information
vickash committed Jul 28, 2024
1 parent 4d933c2 commit 041be66
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions benchmarks/i2c_ssd1306_refresh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
# ESP32-S3 : 51.8 fps (native USB) - Changed from 64 to 128 serial ACK interval
# ESP32-C3 : 51.7 fps (native USB) - Changed from 64 to 128 serial ACK interval
#
# July 27 2024 | i7 8700k CPU | CRuby 3.3.1 | 100 frames | Average of 3 runs
#
# ESP32-H2 : 7.3 fps (WCH UART bridge @ 115200, I2C @ 400kHz)
# ESP32-H2 : 10.9 fps (WCH UART bridge @ 230400, I2C @ 400kHz)
# ESP32-C6 : 8.0 fps (WCH UART bridge @ 115200, I2C @ 1MHz)
# ESP32-C6 : 13.2 fps (WCH UART bridge @ 230400, I2C @ 1MHz)
#
require 'bundler/setup'
require 'denko'

Expand Down
8 changes: 8 additions & 0 deletions src/lib/DenkoI2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ void Denko::i2cSetSpeed(uint8_t code) {
default: Wire.setClock(100000); break;
}
i2cSpeed = code;

// ESP32-H2 doesn't safely fallback if speed > 400kHz is chosen.
#ifdef CONFIG_IDF_TARGET_ESP32H2
if (i2cSpeed > 1) {
i2cSpeed = 1;
Wire.setClock(400000);
}
#endif
}

// CMD = 33
Expand Down

0 comments on commit 041be66

Please sign in to comment.