From bd157fe3f05a6dff357168b3b7d01dfffd40ac59 Mon Sep 17 00:00:00 2001 From: bjoernQ Date: Mon, 26 Jun 2023 11:06:01 +0200 Subject: [PATCH] Avoid SDA/SCL low during pin config --- CHANGELOG.md | 3 ++- esp-hal-common/src/i2c.rs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 925f24bff..8b968dcc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed wrong variable access (FOSC CLK calibration for ESP32-C6 #593) - Fixed [trap location in ram](https://github.com/esp-rs/esp-hal/pull/605#issuecomment-1604039683) (#605) - Fixed a possible overlap of `.data` and `.rwtext` (#616) +- Avoid SDA/SCL being low while configuring pins for I2C ### Changed @@ -63,7 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking - Significantly simplified user-facing GPIO pin types. (#553) -- No longer re-export the `soc` moduleand the contents of the `interrupt` module at the package level (#607) +- No longer re-export the `soc` module and the contents of the `interrupt` module at the package level (#607) ## [0.9.0] - 2023-05-02 diff --git a/esp-hal-common/src/i2c.rs b/esp-hal-common/src/i2c.rs index 30035e599..c4b4cee02 100644 --- a/esp-hal-common/src/i2c.rs +++ b/esp-hal-common/src/i2c.rs @@ -250,7 +250,10 @@ where let mut i2c = I2C { peripheral: i2c }; - // initialize SCL first to not confuse some devices like MPU6050 + // avoid SCL/SDA going low during configuration + scl.set_output_high(true); + sda.set_output_high(true); + scl.set_to_open_drain_output() .enable_input(true) .internal_pull_up(true)