0

I would like to use I2C and SPI pins as a gpio on my raspberry pi zero w. To be more clear, BCM 3-5-7-11-13-14 pins on the link [1]. I want to disable I2C1, GPCLK0, SPI0, UART, PWM0. Is it possible and how if so? I assume I need to make changes in dtb files.

1

Just make sure all of the interfaces are disabled in 'Raspberry Pi Configuration':

enter image description here

or from the command line 'sudo raspi-config':

enter image description here

  • Hmm, that was easy. Does raspi-config app change the pin configuration of cpu within dtb files? Afaik, the configuration of the pins (i2c, uart etx) declared in device tree files. – msaiducar Aug 7 '18 at 9:20
1

Just make sure any reference to SPI, I2C, etc. are commented out in file /boot/config.txt (put a # at the start of the line).

Actually normally no special action is required. The very act of setting a GPIO to be an INPUT or OUTPUT will break any existing association with SPI, I2C etc.

0

I was going to say that best source for REAL answer is datasheet , unfortunately it is buried in this little snippet:

SYNOPSIS The function select registers are used to define th e operation of the general purpose I/O pins. Each of the 54 GPIO pins has at least two al ternative functions as defined in section 16.2. The FSEL{n} field determines the functionalit y of the nth GPIO pin. All unused alternative function lines are tied to ground and w ill output a “0” if selected. All pins reset to normal GPIO input operation. Of course that implies the "alternate function" is NOT selected in raspi-config as already pointed out.

PS raspi-config IS the "official" place to setup alternate pins function - NOT boot config. BUT I did not verify that!

  • 1
    raspi-config just edits /boot/config.txt. I'm not sure that it is included in any distribution other than the raspberrypi.org Raspbian based distributions. – joan Aug 7 '18 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.