Skip to content
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

i2c: Update API to support arbitrary bus speed values #4039

Closed
zephyrbot opened this issue Sep 12, 2017 · 5 comments
Closed

i2c: Update API to support arbitrary bus speed values #4039

zephyrbot opened this issue Sep 12, 2017 · 5 comments
Assignees
Labels
area: API Changes to public APIs area: I2C Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented Sep 12, 2017

Reported by Piotr Mienkowski:

As defined by I2C standard: "The minimum HIGH and LOW periods of the SCL clock specified in Table 10 determine the maximum bit transfer rates of 100 kbit/s for Standard-mode devices, 400 kbit/s for Fast-mode devices, and 1000 kbit/s for Fast-mode Plus. Devices must be able to follow transfers at their own maximum bit rates, either by being able to transmit or receive at that speed or by applying the clock synchronization procedure". Thus the standard does not require that devices always run at the maximum speed allowed at any given mode.

Current I2C API does not allow to set an arbitrary I2C bus speed instead it is using a bit-field encoded value to always select a maximum one.

Recently I2C drivers were updated to use DTS which, based on the existing Linux definitions, allows to set an arbitrary bus speed value. The existing DTS support is only partial since the DTS provided values are only accepted if they match maximum allowed speed.

I2C API should be updated to support arbitrary bus speed values.

(Imported from Jira ZEP-2611)

@zephyrbot zephyrbot added priority: medium Medium impact/importance bug area: I2C Enhancement Changes/Updates/Additions to existing features labels Sep 23, 2017
@nashif nashif added the area: API Changes to public APIs label Apr 10, 2018
@carlescufi carlescufi changed the title Update I2C API to support arbitrary bus speed values i2c: Update API to support arbitrary bus speed values May 28, 2019
@carlescufi
Copy link
Member

Values in DT are already arbitrary integers, this requires a change in i2c_configure() to take a structure instead of a bitmask.

@carlescufi
Copy link
Member

carlescufi commented May 19, 2020

API Meeting 19th May:

  • @henrikbrixandersen mentions that on older products some I2C peripherals were not validated at high speeds, so the speed is reduced to an arbitrary (slower) value.
  • @pabigot running the bus at slower speeds reduces power consumption.
  • Further feedback from @mnkp requested to decide whether we should close this issue or propose an API change

@mnkp
Copy link
Member

mnkp commented Jun 14, 2020

Further feedback from @mnkp requested to decide whether we should close this issue or propose an API change

Yes, I believe we should support arbitrary bus speeds as defined by the standard, even if it requires API change. There are a few more API modifications which might be worth doing. I added a comment to #4040.

@pabigot pabigot self-assigned this Jul 28, 2020
@pabigot pabigot added priority: low Low impact/importance bug and removed priority: medium Medium impact/importance bug labels Jul 28, 2020
@pabigot pabigot removed their assignment Apr 10, 2021
@teburd
Copy link
Collaborator

teburd commented Jun 14, 2022

This has been fixed, at least for most people, with #42812 which allows arbitrary but statically defined scl rates without breaking the API

Dynamically changing the clock to arbitrary values is probably error prone as not every clock value is going to be valid.

@teburd teburd assigned teburd and unassigned MaureenHelm Jun 14, 2022
@teburd
Copy link
Collaborator

teburd commented Mar 23, 2023

I'm considering this closed as I2C speeds are set per bus rather than per device, and DT_SPEED enables just that.

@teburd teburd closed this as completed Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: I2C Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

7 participants