Skip to content

Fix: I2C Scan on ESP32-S2 #712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 11, 2025
Merged

Fix: I2C Scan on ESP32-S2 #712

merged 5 commits into from
Mar 11, 2025

Conversation

brentru
Copy link
Member

@brentru brentru commented Mar 10, 2025

This pull request in conjunction with adafruit/ci-arduino#210 should fix the broken I2C scanning present on ESP32-S2 platforms running WipperSnapper Beta 96 or Beta 97.

This pull request also:

  • Refactors the loop within scanAddresses to match Espressif's I2C Scan Test
    • A little more performant as we check the best-case first, now.
  • Adds handling for I2C transmission error codes (only for ESP32 I2C Scans)

Tested on Adafruit Feather ESP32-S2 w/BME280

Requires adafruit/ci-arduino#210 to be merged in and this PR to be rebuilt before testing again

Resolves - #700

@brentru
Copy link
Member Author

brentru commented Mar 10, 2025

Noting that this needs to be re-built and re-tested after adafruit/ci-arduino#210 is merged.

We will want to cut a new release for Beta 98 after this.

@brentru
Copy link
Member Author

brentru commented Mar 10, 2025

@tyeth Tested again on ESP32-S2 Feather. Please give it a test and ✅ when done!

@brentru brentru requested a review from tyeth March 11, 2025 19:46
@brentru
Copy link
Member Author

brentru commented Mar 11, 2025

[ 55535][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 4 successfully set to type I2C_MASTER_SCL (34) with bus 0x1
[i2c]: Scanning I2C Bus for Devices...
[i2c] Scanning Address: 0x1
[i2c] Did not find device: NACK on transmit of address!
[i2c] Scanning Address: 0x2
[i2c] Did not find device: NACK on transmit of address!
[i2c] Scanning Address: 0x3

@brentru
Copy link
Member Author

brentru commented Mar 11, 2025

Noting that we removed a call to WIRE's setClock(50000). This removes the timeout error introduced in BSP 3.1.x by putting the I2C clock's default clock speed back to the expected 100kHz.

@tyeth tyeth merged commit 31eed58 into main Mar 11, 2025
39 checks passed
@brentru brentru deleted the fix-i2c-scan-issue branch April 14, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants