-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/qn908x/periph_i2c: allow internal pull-up on SCL #19729
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
cpu/qn908x/include/periph_cpu.h
Outdated
@@ -366,6 +366,7 @@ typedef struct { | |||
gpio_t pin_scl; /**< SCL pin */ | |||
gpio_t pin_sda; /**< SDA pin */ | |||
uint32_t speed; /**< bus speed in bit/s */ | |||
bool external_pull_up; /**< Do not enable internal pull-up on SCL? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does anything speak against always enabling this?
That's now it's done on e.g. nRF5x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least in theory this could reduce power consumption while the SCL is driven low by the controller / clock-stretched by the peripheral.
E.g. if a 3.3 V SCL line is driven low and there is a
but e.g. with
But then again, a weaker pull up results in a lower data rate and therefore would consume the current over a longer period of time.
Maybe its best to just enable it always until someone has a real world example where it is beneficial to only have the external pull up.
Always enable the internal pull-up on the SCL line to always have a functional I2C bus. This may increase power consumption where an external pull up is present as well. But let's wait for a real world use case where this would help to extend battery life before making this configurable. This fixes RIOT-OS#19021
76d148b
to
98b3839
Compare
bors merge |
Already running a review |
bors retry |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
bors retry |
Already running a review |
19724: dist/tools/openocd: add OPENOCD_SERVER_ADDRESS variable r=maribu a=fabian18 19729: cpu/qn908x/periph_i2c: allow internal pull-up on SCL r=maribu a=maribu ### Contribution description Allow the board config to specify use of external or external pull-up resistor on the SCL up. Default to the internal pull-up, two weak pull ups in parallel are preferable over no pull-up. Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com> Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
This PR was included in a batch that was canceled, it will be automatically retried |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Contribution description
Allow the board config to specify use of external or external pull-up resistor on the SCL up. Default to the internal pull-up, two weak pull ups in parallel are preferable over no pull-up.
Testing procedure
On
master
: No output at all, board hangs.This PR:
(Note: The mma8x5x is connected via I2C and the driver hangs in master during the first I2C access due to bogus clock stretching due to the missing pull-up.)
Issues/PRs references
This fixes #19021