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

cc13xx and cc26xx serial boards i2c scan not work #38645

Closed
Pillar1989 opened this issue Sep 18, 2021 · 2 comments
Closed

cc13xx and cc26xx serial boards i2c scan not work #38645

Pillar1989 opened this issue Sep 18, 2021 · 2 comments
Assignees
Labels
area: I2C bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug Stale

Comments

@Pillar1989
Copy link

Describe the bug
I believe that's a common issue. because i2c scan function is merged recently.
#21797

To Reproduce
Steps to reproduce the behavior:

  1. mkdir build; cd build
  2. cmake -DBOARD=cc1352r1_launchxl
  3. make
  4. See error

Expected behavior
i2c can work like this.

uart:~$ i2c scan I2C_2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:             -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1e --
20: -- -- -- -- -- -- -- -- -- 29 -- -- -- 2d -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- 56 -- -- -- -- -- -- 5d -- 5f
60: -- -- -- -- -- -- -- -- -- -- 6a -- -- -- -- --
70: -- -- -- -- -- -- -- --
7 devices found on I2C_2

Impact
The impact is minor, it's just not functional.

Logs and console output
No such logs

Environment (please complete the following information):
common issue, so ignore the environment

Additional context
nothing

@Pillar1989 Pillar1989 added the bug The issue is a bug, or the PR is fixing a bug label Sep 18, 2021
@cfriedt cfriedt added this to the v2.7.0 milestone Sep 18, 2021
@cfriedt cfriedt self-assigned this Sep 18, 2021
@cfriedt cfriedt added priority: low Low impact/importance bug has-pr labels Sep 18, 2021
@cfriedt cfriedt linked a pull request Sep 18, 2021 that will close this issue
@cfriedt cfriedt added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label Sep 18, 2021
@cfriedt cfriedt removed this from the v2.7.0 milestone Sep 28, 2021
@cfriedt cfriedt removed the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label Oct 12, 2021
@cfriedt
Copy link
Member

cfriedt commented Oct 12, 2021

As discussed in the linked PR, this SoC is not capable of transmitting the address without any data byte, and therefore scanning was previously disabled.

One possible solution may involve the upcoming pinctrl feature.

Essentially the i2c pin configuration would be swapped out for GPIO pin configuration at runtime for a scan operation.

The cc13xx_cc26xx i2c driver would then instruct the GPIO I2C driver to bit-bang the address and analyze whether a NAK or ACK was received for the address word. When scanning is finished, the original pin configuration (i2c hw) would be restored.

Note, Zephyr already has a GPIO I2C driver, so the cc13xx_cc26xx driver would need to have a phandle to the GPIO i2c device.

This solution could be used for any SoC with buggy i2c hardware, as long as the SoC supported pinctrl / runtime pin reconfiguration.

Other pinctrl-specific calls may be required.

@cfriedt cfriedt removed the has-pr label Oct 12, 2021
@github-actions
Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: I2C bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants