3 Replies Latest reply on Nov 13, 2020 2:24 PM by ajcc

    What pinouts are you using for connecting to I²C and SPI modules?




      I want to put some pin-headers for modules on a board with a RPi Zero W for sensors and other peripherals on modules (or break out boards). Starting with the assumption that there's a de facto standard for the pinout on modules, I tried to find one with Excel by simply entering the pin-out of different manufacturer's modules into columns. I found that some manufactured seemed to just use whatever worked for a 2-layer board, while others were using a consistent pinout (if you accept that they're sometimes mirrored).

      From one manufacturer's modules I found that pin 1. GND, 2. VDD, 3. SDA and 4. SCL was used somewhat consistently for I²C modules (or its mirrored variant). But my joy was short lived when I read the Pmod specification: pin 1. SCL, 3. SDA, 5. GND and 7. VCC (single row on a 2x4 connector). GND and VDD are flipped compared to the other (interestingly this was the most common pinout used by the manufacturer that didn't seem to have a very consistent pinout at first glance). Another standard is the mikroBUS which has a consistent pins for SPI, I²C, UART, Analog, PWM, Power, etc. Their I²C pins are ordered in a row: GND, +5V, SDA and SCL (+3V3 is on another pin).


      With SPI it was much harder to find something consistent since most SPI boards I found were configurable as I²C or SPI. It's the same story as with I²C when comparing Pmod: CS, SDO, SDI, SCK, GND and VCC, to MikroBUS: CS, SCK, SDI, SDO, 3v3 and GND (using the OSHWA naming scheme).


      When I was looking at the Pmod connector which has muxed pins and fixed GND and VCC, I started to wonder if it would make more sense to do that with a RPi that have alternative functions for its GPIO pins? I'm even starting to wonder if it makes sense at all to use a smaller pinheader for modules, instead of just wiring them up on a breadboard and not have to think too much about it. One aspect I wanted from using a fixed pinout is that I can put voltage-level converters between the module and RPi (for example to use 5V with I/O expanders or 1V8 with cheap SPI flash memory). The high-to-low or low-to-high might be an issue since some voltage-level converters I've looked at required that the second input is a strictly lower voltage (not equal and absolutely not higher).


      Anyway... I'm interesting to hear what your thoughts are about this?