-
Notifications
You must be signed in to change notification settings - Fork 3k
STM: I2C: Configure pins in OpenDrainNoPull by default (no pullup) #5113
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
Conversation
As reported by MBED user Fran6Jack: I2C bus are usually 5V tolerant on all STM32 processor. If an external device on the I2C bus requires 5V operation, we usually acheive it by using 5V external pull-ups on the bus. Since signaling uses open-drain output on I2C for both signal SCL and SDA any 5V tolerant MCU will work on a 5V I2C bus. Having pull-up activated on a 5V externally pull bus, cause the pin to clamp on the STM32 die diode and could damage the IC (There is a note in STM32 datasheet specifying this issue). It is understood by all the community that I2C bus should always be externally pulled by physical resistor. I2C initialization should then be ALWAYS OpenDrainNoPull by default. Up to now, this I2C driver was setting pull up by default as it helps basic testing, like 1 master and 1 slave, conencted with 2 wires without any external pull ups. This will not work anymore after this commit and applications tests or examples needs to be modified to explicitely configure pull ups ... But it is safer to follow reference manual guidelines.
@LMESTM, do you see any issues with this PR for expansion board drivers? cc @nikapov-ST |
@betzw No I don't think this would create any side effects with expansion boards as I'm pretty confident that they all include the required pull-ups resistors. The SW side is not impacted at all. |
/morph test |
Result: ABORTEDYour command has finished executing! Here's what you wrote!
|
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Description
As reported by MBED user Fran6Jack:
I2C bus are usually 5V tolerant on all STM32 processor.
If an external device on the I2C bus requires 5V operation,
we usually acheive it by using 5V external pull-ups on the bus.
Since signaling uses open-drain output on I2C for both signal SCL and SDA
any 5V tolerant MCU will work on a 5V I2C bus. Having pull-up activated on a 5V externally pull bus, cause the pin to clamp on the STM32 die diode and could damage the IC (There is a note in STM32 datasheet specifying this issue).
It is understood by all the community that I2C bus should always be
externally pulled by physical resistor. I2C initialization should then
be ALWAYS OpenDrainNoPull by default.
Up to now, this I2C driver was setting pull up by default as it helps
basic testing, like 1 master and 1 slave, conencted with 2 wires without
any external pull ups. This will not work anymore after this commit and
applications tests or examples needs to be modified to explicitely
configure pull ups ... But it is safer to follow reference manual
guidelines.
Notes:
This is a fix to #5102
Status
READY
Question / open point
After this change, any test or example that was working when simply plugging 2 wires between SDA and SCL pins of 2 boards will not work anymore. There is a need to add external pul-ups - is this fullay acceptable for everyone ?
If not, there is a need for introduction of a new mode interface in I2C class.
Tests