Available Functionality
rPi | GPIO | I2C | PWM | SPI | UART |
---|---|---|---|---|---|
rPi A | 17 | I2C0 | PWM0 | SPI0 | UART0 or UART1 |
rPi B Rev 1 | 17 | I2C0 | PWM0 | SPI0 | UART0 or UART1 |
rPi B Rev 2 | 17 + 4 | I2C1 | PWM0 | SPI0 | UART0 or UART1 |
rPi A+ | 28 | I2C0 and I2C1 | PWM0 and PWM1 | SPI0 and SPI1 | UART0 or UART1 |
rPi B+ | 28 | I2C0 and I2C1 | PWM0 and PWM1 | SPI0 and SPI1 | UART0 or UART1 |
rPi Zero | 28 | I2C0 and I2C1 | PWM0 and PWM1 | SPI0 and SPI1 | UART0 or UART1 |
rPi2 B | 28 | I2C0 and I2C1 | PWM0 and PWM1 | SPI0 and SPI1 | UART0 or UART1 |
rPi3 B | 28 | I2C0 and I2C1 | PWM0 and PWM1 | SPI0 and SPI1 | UART1 |
Please note the following:
- GPIO access via bcm2835_gpiomem just allows unfetted access into the GPIO registers to users. There is nothing to stop pins being reconfigured that are in use elsewhere (e.g. by other kernel modules). Probably should consider it as an interim solution only.
- I2C0 is kind of reserved for rPi hardware detection. Pins are purposely (mis)named as ‘eeprom’ on 40pin header rPi’s to mask their true function. As I2c0 is scanned for i2c eeproms prior to linux booting so be cautious and if you have any boot issues you know where to start looking!
- Clock stretching on the I2C only works under certain circumstances. See this forum thread: https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=13771&sid=e788ea003e604cfce8c4312b05d2eeef&start=50
- PWM0 & PWM1 make sure you read and follow the instructions to set these up properly. A little bit hacky to get going but stable and functional when setup.
- UART0 and UART1 use the exact same GPIO pins so you can only use one.
- PI3B uses UART0 for the bluetooth module so only UART1 is available to users. It is possible to deactivate the bluetooth module and reactivate UART0 to the GPIO header however.