Skip to content

Increase I2C stability at 400KHz. #288

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

Closed
wants to merge 6 commits into from

Conversation

ghent360
Copy link
Contributor

I was testing u8g library with an SSD1306 i2c display.
For some reason I2C communication receives NAK on the device address byte after a while at 400KHz. It transfers maybe 100 bytes or so, then the device responds with a NAK and everything stops. It works fine at 100KHz.

I moved the GPIO initialization before the I2C device clock setup and it magically works all the time. Can't quite figure out why, but it does not seem to hurt.

@fpistm fpistm self-requested a review July 30, 2018 09:43
@fpistm
Copy link
Member

fpistm commented Jul 30, 2018

Hi @ghent360,
right, I Can't quite figure out why also.
As it is done only one time, at the Wire.Begin().
Maybe the u8g library called several time the Begin ?

One possible improvement could be to change
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
to
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

@ghent360
Copy link
Contributor Author

ghent360 commented Jul 30, 2018 via email

@fpistm
Copy link
Member

fpistm commented Aug 15, 2018

I think #305 should solve this issue.

@ghent360 ghent360 closed this Aug 27, 2018
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