I just read through the Nordic and RayTac manuals and discovered answers to what we were talking about today re. pin assignments for TS06.3

Here are the “standard” pin assignments for SPI, I2C and UART.  There are two SPI controllers, two I2C controllers, and one UART controller.  It is only possible to have three such “serial” devices active simultaneously.  I discuss this more below under “Controller conflicts”

First let’s collect up all the standard pin assignments that the the Nordic software assumes.

Standard Pins Assignments

SPI

There are two SPI controllers SPI0, and SPI1.  The pin numbers are as follows.  The DW module should be connected to SPIM0
#define SPIM0_SCK_PIN       23u     /**< SPI clock GPIO pin number. */
#define SPIM0_MOSI_PIN      20u     /**< SPI Master Out Slave In GPIO pin number. */
#define SPIM0_MISO_PIN      22u     /**< SPI Master In Slave Out GPIO pin number. */
#define SPIM0_SS_PIN        21u     /**< SPI Slave Select GPIO pin number. */

#define SPIM1_SCK_PIN       29u     /**< SPI clock GPIO pin number. */
#define SPIM1_MOSI_PIN      24u     /**< SPI Master Out Slave In GPIO pin number. */
#define SPIM1_MISO_PIN      28u     /**< SPI Master In Slave Out GPIO pin number. */
#define SPIM1_SS_PIN        25u     /**< SPI Slave Select GPIO pin number. */

I2C

There are two I2C controllers.  Each controller uses two GPIO pins which can be any of the available GPIOs.
#define TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER (24U)
#define TWI_MASTER_CONFIG_DATA_PIN_NUMBER (25U)

UART

Any four pins can be used for the UART.  The standard pins to use are:
#define RX_PIN_NUMBER  11
#define TX_PIN_NUMBER  9
#define CTS_PIN_NUMBER 10
#define RTS_PIN_NUMBER 8

ADC

I added in the ADC pins because they are special, and we might need the odd ADC pin for something.  The ADC uses a minimum of two pins.  One samples the input, and the other provides a reference voltage.  If we have any ADC needs then we will have to use:

  • either pin 23 or pin 17 for reference voltages.
  • pins 9, 10, 18, 19, 20, 21, 22, or 23 as inputs.

Because 9 and 10 are used for the UART, and 20-23 for the SPI0, we are left with 17, 18 and 19.

#define AREF0            17u      // ADC reference pin
#define AIN2             18u      // ADC sample pin #1
#define AIN3             19u      // ADC sample pin #2

Controller conflicts

It isn’t possible to have all five serial controllers active at the same time because they share address space. 

SPI0 and I2C0 share the same address space
SPI1 and I2C1 share the same address space
The UART has it’s own address space. 
So allowed combos are:

  • UART and 2 x SPI, or 
  • UART and 2 x I2C, or 
  • UART and 1 x SPI, and 1 x I2C.
There are various weasel words that allow other combinations, but we must have 1 x SPI for the DW, and 1 x I2C for the Coulomb counter.  Clearly I will have to figure out how to string other devices on the SPI bus with the DW.

Summary of suggested Nordic GPIO pin assignments

So pulling all this together we end up with the following constraints on pin assignments
#define                      0u
#define                      1u
#define                      2u
#define                      3u
#define                      4u
#define                      5u
#define                      6u
#define                      7u

#define RTS_PIN_NUMBER       8u      // UART
#define TX_PIN_NUMBER        9u      // UART
#define CTS_PIN_NUMBER      10u      // UART
#define RX_PIN_NUMBER       11u      // UART

#define                     12u
#define                     13u
#define                     14u
#define                     15u
#define                     16u


#define AREF0               17u      // ADC reference pin
#define AIN2                18u      // ADC sample pin #1
#define AIN3                19u      // ADC sample pin #2


#define SPIM0_MOSI_PIN      20u     /**< SPI Master Out Slave In GPIO pin number. */
#define SPIM0_SS_PIN        21u     /**< SPI Slave Select GPIO pin number. */
#define SPIM0_MISO_PIN      22u     /**< SPI Master In Slave Out GPIO pin number. */
#define SPIM0_SCK_PIN       23u     /**< SPI clock GPIO pin number. */

#define I2C_CLK             24U     // I2C clock pin
#define I2C_DAT             25U     // I2C data pin

#define                     26u
#define                     27u
#define                     28u
#define                     29u
#define                     30u
#define                     31u

Other pins that can be connected to any GPIO are
DW_IRQ
DW_RSTn  — this may not be needed
DW_WAKEUP

SLAVE_SEL x N  for any other SPI devices beyond DW which uses pin21

All other pins can be assigned to LEDS, or BUTTONS





Leave a Reply