UART, I2C, SPI, PDM and USB Pin Mapping for nRF5340 (NRF5340-QKAA-R7)

Hello Nordic Team,

We are working with the NRF5340-QKAA-R7 and need clarification on which physical pins can be used for UART, I2C, SPI, PDM and USB interfaces.

We have reviewed the datasheet and product specification, but the pin mapping information for this specific package is not clearly defined.
It’s difficult to determine which GPIOs correspond to the available peripherals (UART, I2C, SPI, PDM and USB), and how to configure them correctly.


we have already checked the latest nRF5340 Product Specification, version v1.6, and we are referring to the same document.

 

As per the v1.6 specification, the pin definitions are clearly provided for AIN, NFC, debug pins, one SPI interface, and QSPI. However, the document does not explicitly define fixed pin assignments for other peripherals such as UART, PDM, and I2C.

 

Our understanding is that these peripherals can be mapped to any suitable GPIOs using the pin multiplexing options. Before proceeding with the final connections, we just want to confirm this to avoid any mismatch at a later stage.

 

Please let us know your confirmation or if there are any specific recommendations for GPIO assignment for these interfaces.

Our goal is to use the following peripheral setup:

  • Two UART interfaces

  • Three I2C (TWI) interface

  • Three SPI interfaces

  • One PDM interface

  • One USB interface

Could you please help us with:

  1. The correct pin mapping for each of these peripherals on the "NRF5340-QKAA-R7 94QFN" package, and

  2. Any reference documentation, pin configuration examples, or Devicetree guidance for this specific part number (NRF5340-QKAA-R7).


  • Hi,

    As per the v1.6 specification, the pin definitions are clearly provided for AIN, NFC, debug pins, one SPI interface, and QSPI. However, the document does not explicitly define fixed pin assignments for other peripherals such as UART, PDM, and I2C.

     

    Our understanding is that these peripherals can be mapped to any suitable GPIOs using the pin multiplexing options. Before proceeding with the final connections, we just want to confirm this to avoid any mismatch at a later stage.

    Yes you are right, most of the peripheral on nRF5240 can be assigned to your selected GPIO and they are not fixed. There are a few  exceptions:
    * When choosing a GPIO for specific peripheral, please make sure t
    he pin is a normal GPIO (not SWD, not N.C. not a dedicated pin for other peripherals)

    In this page: Pin assignments you can see the pin assignments details for nRF5240. Please note the right column which is named by "Recommended usage" ,  by checking that you can see that some of the pins are recommended for specific peripherals but most of the GPIOs are general purpose and can be assigned to different peripherals. For the recommended pins for specific peripherals please closely follow the table and do not use other pins. But for the peripherals that are not mentioned in "recommended usage" column you are free to choose the GPIO.


    Our goal is to use the following peripheral setup:

    • Two UART interfaces

    • Three I2C (TWI) interface

    • Three SPI interfaces

    • One PDM interface

    • One USB interface

    Could you please help us with:

    Regarding your use case, the USB interface has dedicated pins (D+ and D-) and cannot be assigned to general purpose GPIO, the rest can be assigned to GPIOs, please note the following limitations as well:

    *High-Speed TWI (I2C): If you require 1 Mbps speed, you must use the dedicated high-speed TWI pins. P1.02 (SDA) and P1.03 (SCL). These pins support a 20 mA open-drain driver (E0E1) required for 1 Mbps operation [Special GPIO considerations].

    *High-Speed SPI (SPIM4): For 32 Mbps operation, you must use: P0.08 (SCK), P0.09 (MOSI), P0.10 (MISO), and P0.11 (CSN) [Special GPIO considerations].

    *Low-Frequency Crystal: By default, P0.00 and P0.01 are used for the 32.768 kHz crystal. Avoid using these for peripherals if a crystal is present.



    Also regarding the required number of peripherals (2*UART, 3*I2C, 3*SPI) , please note that the total Available Instances on application core is:
    *Up to 4x UART 
    *Up to 4x I2C (TWIM)
    *Up to 5x SPI (4 standard sharing IDs + 1 dedicated high-speed SPIM4) 

    But the important point is that not all of the instances can be used simultaneously as they are using shared ID (and base address in memory). Since there are only 4 shared ID slots (ID 0, 1, 2, and 3) plus one dedicated high-speed SPI slot (SPIM4), the application core generally only supports a maximum of 5 serial instances simultaneously.

    So if you are planning to use them simultaneously it is not possible all of them at once, one solution would be to use several external devices on same communication bus for example for SPI or I2C and mitigate the limitation. 

    Memory:



    another similar issue:
    (+) How many peripheral instance i can use in nRF5340? - Nordic Q&A - Nordic DevZone - Nordic DevZone

Related