2

I need to use the ID_SD and ID_SC pins for a ultrasonic sensor. Is this possible?

I am already using SDA and SCL for i2c communication so disabling the i2c bus in raspi-config is not an option.

This stackexchange post sheds some light on it but seems to suggest it might be possible. Does anyone have any input on this? Thank you.

Shoumik
  • 23
  • 1
  • 4

1 Answers1

1

As far as I am aware you will be fine provided

  1. You are not using a HAT which is configured via ID_SD and ID_SC.
  2. You are not using a Pi3 or if you are using a Pi3 you will not be using the ID_SD or ID_SC GPIO in I2C mode.

The Pi3 uses I2C bus 0 for internal purposes. Setting the ID_SD and ID_SC GPIO as I2C will confuse I2C bus 0.

joan
  • 71,024
  • 5
  • 73
  • 106
  • Pins 27/28 are configured as Input after boot. I have seen instructions for setting them as I²C (but have not tested this). They are certainly NOT configured as I²C in normal use, so I see no evidence they cannot be used as normal. – Milliways Sep 12 '16 at 11:48
  • @joan I am using it with a Pi 3. Looks like I'm out of luck. – Shoumik Sep 12 '16 at 12:01
  • @Milliways I think they're set as i2c if the i2c bus is enabled in raspi-config. – Shoumik Sep 12 '16 at 12:03
  • @joan Is it possible to switch my SDA and SCL to ID_SD and ID_SC respectively and use them as my i2c connections? Or is i2c bus 0 for Pi3 absolutely out of the question? – Shoumik Sep 12 '16 at 12:44
  • @kimuohs Not on a Pi3. Using I2C bus 0 is a no no. However perhaps Milliways is correct, in which case just try using 27/28 as normal GPIO and see if the sonar ranger works. – joan Sep 12 '16 at 13:20
  • @joan it doesn't work. – Shoumik Sep 12 '16 at 13:28
  • @kimuohs I have just connected a sonar ranger to GPIO 0/1 (trigger/echo) with power from 5V and it works on my Pi3. I get good readings. Perhaps try again. I will need to amend my answer after some more tests. – joan Sep 12 '16 at 15:25
  • @Milliways I think you are correct. I have just used the pins for a sonar ranger. I think the only restriction is you don't try to use them as an I2C bus on the Pi3. – joan Sep 12 '16 at 15:50
  • @joan Was your I2C bus enabled or disabled in raspi-config? – Shoumik Sep 13 '16 at 17:47
  • @kimuohs I2C bus 1 was enabled, bus 0 wasn't. – joan Sep 13 '16 at 18:16
  • What about Compute Module? It is not mentioned anywhere to not use GPIO 0,1 – Arahasya Apr 20 '20 at 07:28
  • It is written ALL pins can be used as GPIO's when not using alternate functions – Arahasya Apr 20 '20 at 07:30