Skip to content

Conversation

me-no-dev
Copy link
Member

Summary

This PR is a complete refactoring of Wire Library and I2C HAL in order to use IDF instead of current Register manipulation approach.

It implements Thread-safe Arduino Wire.

Fix #5478
Fix #5635
Fix #5636
Fix #4729
Fix #5470

Impact

It solves many reported issues related to I2C.

@me-no-dev me-no-dev added this to the 2.0.1 milestone Sep 20, 2021
@me-no-dev me-no-dev self-assigned this Sep 20, 2021
@me-no-dev
Copy link
Member Author

@marcboon please also post the part of the code that crashes :)

@marcboon
Copy link

@marcboon please also post the part of the code that crashes :)
it seems to be unrelated

@me-no-dev
Copy link
Member Author

@marcboon took a sec to figure it out, but you are trying to set a frequency of 4MHz instead of 400KHz :)

@marcboon
Copy link

marcboon commented Sep 21, 2021 via email

@me-no-dev
Copy link
Member Author

that happens inside IDF's I2C driver. We can ask there why that is so.

@me-no-dev
Copy link
Member Author

I will just limit the frequency on our end to prevent it.

@me-no-dev
Copy link
Member Author

@marcboon seems Adafruit disabled the clock adjustment for their Feather ESP32, but not for other ESP32 based boards. In any case, I limited the clock to 1MHz and that seem to not trigger WDT anymore.

@Jason2866
Copy link
Collaborator

Works 👍

@ladyada
Copy link
Contributor

ladyada commented Sep 21, 2021

@me-no-dev you can re-enable feather esp32 clock adjustment, we dont even know what that is (?)

@me-no-dev
Copy link
Member Author

@ladyada here is the offending line :) https://github.com/adafruit/Adafruit_SSD1306/blob/master/Adafruit_SSD1306.cpp#L91
I will add PR but I want to have a look at the clock switching, because it seems it does not always return to the base clock so 100kHz devices are unhappy

@ladyada
Copy link
Contributor

ladyada commented Sep 21, 2021

hi, its unclear what is wrong with that line - we offer an optional way to speed up writes and it is enabled on the ESP32 (only disabled on STM32) for when we burst-write to the OLED.
it sounds like the bug is in the IDF where 4MHz should be rejected or pared down to the max speed and that'll be fixed shortly :)

@me-no-dev
Copy link
Member Author

@ladyada ahh so sorry... it's STM32 not ESP32... my bad! The 4MHz thing I already fixed on Arduino side

@me-no-dev me-no-dev merged commit f87107d into master Oct 1, 2021
@me-no-dev me-no-dev deleted the feature/wire_ng branch October 1, 2021 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants