Probe with the software I2C port in every autodetect block until the board is confirmed - #270
Merged
Merged
Conversation
…board is confirmed Several blocks still opened a hardware I2C port to identify the board and handed it over only when a board matched. When none did, the ESP32 AXP probe left I2C_NUM_1 open on G21/G22: with the ESP-IDF i2c_master driver the pins stay reserved, so M5Unified opening the same pins on I2C_NUM_0 for a Core BASIC logged "i2c.common: GPIO 21/22 is not usable, maybe conflict with others", and I2C_NUM_1 was left unusable for the application. The other blocks released the port on a miss but still touched the peripheral and pins of a board that was not there. Every block now probes on the software port and opens the hardware port right after the board is confirmed (the backlight and touch use it), matching what the newer chips already did. probe_i2c_t bundles the sequence so all eleven blocks follow it, including the pre-existing soft probe blocks (Tab5, NessoN1, ToughC5, CoreMatrix): - The software port routes SDA/SCL to plain GPIO output while probing. When the hardware port was already opened by the application (shared bus), init() leaves the pins as the owner configured them, so the GPIO routing left behind by the probe would cut the port off from its pads and every later transfer from the backlight and touch drivers would fail. The probe backs up both pads before it starts and restores them right after it is released, on the handover and on the miss path alike. - PaperS3, StickS3 and NessoN1 test the pull-ups on SDA/SCL with gpio::command before probing, which already routes the pads to GPIO, so those blocks hand the backup they took before the test to the probe. - The UnitC6L block opens its port only once the panel matched.
…confirmed Probing on the software port means a board can now be identified even when the hardware port fails to open (a slave driver holding it, for one). The identification is kept, since dropping it would lose the display as well, but the users of that port would fail silently, so leave a warning that names the port and pins.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Several autodetect blocks still opened a hardware I2C port to identify the board and handed it over only when a board matched. When none did, the ESP32 AXP probe left
I2C_NUM_1open on G21/G22. With the ESP-IDFi2c_masterdriver the pins stay reserved, so M5Unified opening the same pins onI2C_NUM_0for a Core BASIC logsand
I2C_NUM_1was left unusable for the application. The other blocks released the port on a miss but still touched the peripheral and pins of a board that was not there.Every block now probes on the software port (
probe_i2c_port) and opens the hardware port right after the board is confirmed, matching what the newer chips already did. A smallprobe_i2c_thelper bundles the sequence so all eleven blocks follow it, including the pre-existing soft probe blocks (Tab5, NessoN1, ToughC5, CoreMatrix):init()leaves the pins as the owner configured them, so the GPIO routing left behind by the probe would cut the port off from its pads and every later transfer from the backlight and touch drivers would fail. The probe backs up both pads before it starts and restores them right after it is released, on the handover and on the miss path alike.gpio::commandbefore probing, which already routes the pads to GPIO, so those blocks hand the backup they took before the test to the probe.Verification
Detection, display, backlight sweep,
In_I2Cscan and touch, compared againstdevelopon the same boards:In_I2C/Ex_I2CunchangedIn_I2COKIn_I2COKIn_I2COKIn_I2COKShared bus: with the application opening
I2C_NUM_1on the internal bus throughi2c_new_master_bus()beforeM5.begin(), Core2 and CoreS3 keep the backlight, touch,In_I2C(4 / 9 devices) and the application's own transfers working. Without the pad restore, the same setup leftIn_I2Cat 0 devices, broke the application's transfers, and misidentified the CoreS3 as CoreS3SE.Builds: ESP32 / ESP32-S3 / ESP32-C6 / ESP32-C5 / ESP32-P4 (ESP-IDF and Arduino).