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

Raspberry Pi 5 - Toggling GPIOs with gpiod disables I2C addresses #1933

Open
nickFridays opened this issue Jan 7, 2025 · 12 comments
Open

Raspberry Pi 5 - Toggling GPIOs with gpiod disables I2C addresses #1933

nickFridays opened this issue Jan 7, 2025 · 12 comments

Comments

@nickFridays
Copy link

nickFridays commented Jan 7, 2025

Hello,
Raspberry Pi 5 - Toggling GPIOs with gpiod disables I2C addresses
pi@pi:~ $ pinout
Description : Raspberry Pi 5B rev 1.0
Revision : d04170
SoC : BCM2712
RAM : 8GB
Storage : MicroSD
USB ports : 4 (of which 2 USB3)
Ethernet ports : 1 (1000Mbps max. speed)

pi@pi:~ $ uname -a
Linux pi 6.6.62+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.62-1+rpt1 (2024-11-25) aarch64 GNU/Linux

pi@pi:~ $ gpiodetect
gpiochip0 [pinctrl-rp1] (54 lines)
gpiochip10 [gpio-brcmstb@107d508500] (32 lines)
gpiochip11 [gpio-brcmstb@107d508520] (4 lines)
gpiochip12 [gpio-brcmstb@107d517c00] (17 lines)
gpiochip13 [gpio-brcmstb@107d517c20] (6 lines)
gpiochip0 [pinctrl-rp1] (54 lines)

pi@pi:~ $ ls /dev/i2*
/dev/i2c-1 /dev/i2c-13 /dev/i2c-14
pi@pi:~ $ sudo raspi-config nonint get_i2c

image

@6by9
Copy link

6by9 commented Jan 7, 2025

@pelwell
Copy link
Contributor

pelwell commented Jan 7, 2025

  1. What hardware is attached (and how)?
  2. Does this only happen when toggling GPIO 5?
  3. You should use gpiochip0 now - gpiochip4 is supported for backwards compatibility.

@nickFridays
Copy link
Author

nickFridays commented Jan 7, 2025

@pelwell thank you for your quick response.

  1. 3 SPI devices , 4 I2C devices. All 3 SPI devices communicate with Pi-5 and work fine. When GPIOs are not toggled , all SPI and 4 I2C devices communicate and work fine. Disconnecting one or two I2C dev. doesn't help.
  2. The issue manifests itself with various GPIOs
  3. I did try both chip0 and chip4 . I am not sure, It looks like it doesn't matter with the latest kernel.

@pelwell
Copy link
Contributor

pelwell commented Jan 7, 2025

That's a lot of hardware for one Pi 5:
4. Which power supply are you using?
5. Is that the only source of power in the system?
6. What does dmesg -l err,warn report?
7. What's in your config.txt?

@nickFridays
Copy link
Author

  1. Each device is just a about 20 mAmps. 6Amp PSU no warning messages from Pi.
  2. I did try a 5V power booster with no effect.
  3. config.txt is a default with one line added for CAN bus.

@pelwell
Copy link
Contributor

pelwell commented Jan 7, 2025

config.txt is a default with one line added for CAN bus.

i2c-1 should be disabled then.

@nickFridays
Copy link
Author

nickFridays commented Jan 7, 2025

Pi - 4 works fine with the same setup when using RPi.GPIO lib. (it needs to doublecheck)

@nickFridays
Copy link
Author

config.txt is a default with one line added for CAN bus.

i2c-1 should be disabled then.

Is that an assumption or a statement ? Could you please point to any doc ? Thanks

@pelwell
Copy link
Contributor

pelwell commented Jan 7, 2025

It's a statement. By default, the I2C interfaces are disabled. Unless you have a HAT with an EEPROM which causes an overlay to be loaded, it necessary to add something to config.txt that enables i2c-1 - either dtparam=i2c_arm or some overlay that also enables I2C. Which overlay are you loading for the CAN bus?

@nickFridays
Copy link
Author

nickFridays commented Jan 7, 2025

dtparam=i2c_arm=on

dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=6
dtoverlay=pwm,pin=13,func=4

@pelwell
Copy link
Contributor

pelwell commented Jan 7, 2025

So not exactly

config.txt is a default with one line added for CAN bus

@nickFridays
Copy link
Author

nickFridays commented Jan 7, 2025

my bad.

Resolved : Raspberry Pi -5 hardware issue. gpiod lib works fine .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants