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 shell functions non-functional on nRF53 #31248

Closed
thedjnK opened this issue Jan 12, 2021 · 2 comments · Fixed by #34388
Closed

i2c shell functions non-functional on nRF53 #31248

thedjnK opened this issue Jan 12, 2021 · 2 comments · Fixed by #34388
Assignees
Labels
area: I2C bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: low Low impact/importance bug

Comments

@thedjnK
Copy link
Collaborator

thedjnK commented Jan 12, 2021

Describe the bug
I2C is working on an nRF53-based system e.g. using sensor sample apps, however the I2C shell itself does not seem to function at all.

To Reproduce
Steps to reproduce the behavior:

  1. Build BME680 sample for nRF53 (nrf5340dk_nrf5340_cpuapp) with shell enabled
  2. Build hello world sample for nRF53 (nrf5340dk_nrf5340_cpuapp) with shell enabled
  3. Flash BME680 sample app
  4. Observe that sensor data is correctly output
  5. Try to scan I2C bus, it returns 0 devices
  6. Flash hello world sample app
  7. Try to scan I2C bus, it returns 0 devices
  8. Try to read from BME680 sensor, it fails

Expected behavior
It to work

Impact
Seems like a bit of an annoyance if this doesn't work

Logs and console output
Output from BME680 sample app:
uart:~$ *** Booting Zephyr OS build zephyr-v2.4.0-2823-gf4a26837c8cb ***
Device 0x20000234 name is BME680
T: 24.100000; P: 100.585000; H: 42.176000; G: 37582.000000
T: 24.180000; P: 100.585000; H: 42.056000; G: 46444.000000
T: 24.220000; P: 100.586000; H: 41.935000; G: 51387.000000
T: 24.250000; P: 100.585000; H: 41.840000; G: 55226.000000

scan I2C_1
       0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:             -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
0 devices found on I2C_1

Output from hello world:

*** Booting Zephyr OS build zephyr-v2.4.0-2823-gf4a26837c8cb  ***
Hello World! nrf5340dk_nrf5340_cpuapp

uart:~$ i2c scan I2C_1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:             -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
0 devices found on I2C_1
[00:00:03.736,206] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:03.736,419] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:03.736,938] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:03.737,121] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:03.737,609] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:03.737,792] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:03.738,311] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:03.738,525] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:03.738,708] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:03.739,013] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
[00:00:04.239,135] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0

uart:~$ i2c read_byte I2C_1 0x76
Failed to read from device: I2C_1
uart:~$ i2c read I2C_1 0x76
Failed to read from device: I2C_1
uart:~$ i2c read I2C_1 0x76 1
Failed to read from device: I2C_1

Environment (please complete the following information):

  • OS: Windows 7
  • Toolchain: GNU GCC from ARM (version 9.3.1, 2020 Q2 update)
  • Commit SHA or Version used: Mainline zephyr and also nRF connect SDK (issue appears on both). Mainline zephyr commit: f4a2683

Additional context
Add any other context about the problem here.

@thedjnK thedjnK added the bug The issue is a bug, or the PR is fixing a bug label Jan 12, 2021
@nashif nashif added area: I2C priority: low Low impact/importance bug labels Jan 12, 2021
@pabigot
Copy link
Collaborator

pabigot commented Jan 12, 2021

Initial review suggests the nRF53 doesn't behave the same as nRF52 with respect to transfers with no data, which is the mechanism used to detect presence of a device on the bus. The sensor signals an ACK at the end of the address, but the underlying nrfx driver must be continuing to perform a transaction even though the length should be zero, which produces an error instead of a success return.

This seems to be a difference in behavior at the nrfx driver level for the two chip lines. @anangl any ideas?

@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 platform: nRF Nordic nRFx priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants