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.
Instead of empirically determining the I2C SDA hold time, calculate the number of clock ticks to get the 300ns required value. See https://www.nxp.com/docs/en/user-guide/UM10204.pdf#page-48, table note [3] for the origin of the 300ns value.
The hardware default is 1, but that is arbitrary, since the length depends on
ic_clk
. 2 was enough to fix several I2C devices. 5 was need for PA1010D. However, the calculated value is 38 for 300ns. So the other values were quite marginal; this should be a lot safer.Tested with PA1010D, LIS3DH, BME280, BNO055, and TCS34725.
See adafruit/pico-sdk#3 for a screenshot.