This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sharing GPIO between I2C and SPI ?

Dear Members,

How can I share GPIO pin between SPI and I2C peripheral ?

I see SCK_PIN and MISO_PIN for SPI are the same with SCK and SDK on I2C

#define SER_APP_SPIM0_SCK_PIN       NRF_GPIO_PIN_MAP(0,27)     // SPI clock GPIO pin number.
#define SER_APP_SPIM0_MOSI_PIN      NRF_GPIO_PIN_MAP(0,2)      // SPI Master Out Slave In GPIO pin number
#define SER_APP_SPIM0_MISO_PIN      NRF_GPIO_PIN_MAP(0,26)     // SPI Master In Slave Out GPIO pin number

#define ARDUINO_SCL_PIN             27    // SCL signal pin
#define ARDUINO_SDA_PIN             26    // SDA signal pin

Thanks

Parents
  • Hi,

    Any GPIO can be assigned to any serial peripheral in all the nRF5x series ICs, thanks to the pin crossbar feature. Just disable one peripheral using the pins before assigning the pins to another peripheral. You cannot configure two different peripherals to control the same GPIOs at the same time.

    Note that the defines in the board header files are used for different examples, and may not all be intended for use by one example. These pins often chosen from convenience by the software developer, and may not be optimal from a HW perspective or for your application. E.g, make sure that you follow the guidelines with regards to "Standard drive, low frequency I/O only" markings in Pin assignments documentation.

    Best regards,
    Jørgen

Reply
  • Hi,

    Any GPIO can be assigned to any serial peripheral in all the nRF5x series ICs, thanks to the pin crossbar feature. Just disable one peripheral using the pins before assigning the pins to another peripheral. You cannot configure two different peripherals to control the same GPIOs at the same time.

    Note that the defines in the board header files are used for different examples, and may not all be intended for use by one example. These pins often chosen from convenience by the software developer, and may not be optimal from a HW perspective or for your application. E.g, make sure that you follow the guidelines with regards to "Standard drive, low frequency I/O only" markings in Pin assignments documentation.

    Best regards,
    Jørgen

Children
Related