nRF52480 to RAK4631 pin mapping

I was working on a SD Card example from NRF SDK v16 and was wondering about the SPI interface pin mapping. The example is using the following pin configuration :

Clock Pin : 1.15 (Port : 1 , Pin : 15)
MOSI Pin : 1.13
MISO Pin : 1.14
Reset Pin : 1.12

Whereas, I see that the only pins mapped on Port-1 are pin number 1,2,3 and 4. I don’t see pin number 12,13,14,15 etc.

So I tried to approach it the other way round i.e. using the WisBlock SPI pins and changing the example’s pin mapping in accordance to that.

image

So keeping in view the above schematics , I made the following changes :

MOSI Pin : 1.13 --> 0.02 (Port : 0, Pin : 2)
MISO Pin : 1.14 --> 0.03
Reset Pin : 1.12 --> 1.02
Clock Pin : 1.15 --> (??)(USB)

In this approach, I see a problem with the clock pin, it’s not mapped to any port/pin on nrf52840.
Is the approach correct ? How can I properly map the clock pin ?

If you want to use SPI with WisBlock RAK4631 Core module, RAK5005-O Base Board and any WisBlock module that uses SPI you cannot change the assignment of the SPI pins.

You have to use what is assigned in variant.h of the Arduino BSP

#define PIN_SPI_MISO (29) // => Port 1.13
#define PIN_SPI_MOSI (30) // => Port 1.14
#define PIN_SPI_SCK (3) // Port 0.03
    static const uint8_t SS = 26; // Port 1.10

If you change these, the connection of the SPI pins on the WisBlock modules will not work.

This is independent of using Arduino BSP or Nordic SDK. These connections are hardwired and you have to use exactly these assignments.

Your changes above make absolute no sense.

Right.
Can you explain how did you come up with the correct port/pin number on nrf52840 corresponding to the RAK4631 pins. For instance, how MISO Pin (29) is mapped on the port 1.13 ? Because I don’t see anything as such on the schematics or in variant.h

You can find the assignments of IO’s to physical pin numbers in the nRF52840 datasheet.

But it doesn’t matter, all you need to know is the correct GPIO number.