XIAO NRF52840 Plus

Hi there,

So , what is it you want to do Specifically… you don’t really say,
you can do stuff like this in the setup.

Method 1: Using the Arduino IDE

  1. Modify pin definitions: In the setup() function of your Arduino sketch, redefine the pins you want to use.
  2. Use the library’s functions: Use the SPI library’s functions like SPI.begin() to initialize the SPI peripheral with the new pin assignments.
  3. Example:
#include <SPI.h>

// Define your new SPI pins
#define SCK_PIN 13
#define MISO_PIN 12
#define MOSI_PIN 11
#define CS_PIN 10

void setup() {
  Serial.begin(9600);
  
  // Initialize SPI with the new pins
  SPI.begin(SCK_PIN, MISO_PIN, MOSI_PIN, CS_PIN);
  
  Serial.println("SPI initialized with new pins");
}

void loop() {
  // Your main code
}

or…

Method 2: Using nRF Connect SDK or Zephyr Project

  1. Locate configuration files: Find the board’s pin control configuration files, such as <my-board>-pinctrl.dtsi and <board>.overlay.
  2. Modify pin assignments: Edit the files to define new pin multiplexing configurations for the desired peripheral (e.g., spi0_default, uart0_default).
  3. Use the drivers: Use the Nordic Semiconductor (nrfx) drivers or Zephyr’s drivers to uninitialize the old peripheral, then reinitialize it with the new pin configuration.
  4. Example (using zephyr overlay file):
// in <board>.overlay
/ {
  aliases {
    my-spi = &spi0;
  };
};

&spi0 {
  status = "okay";
  pinctrl-0 = <&spi0_default>;
  pinctrl-1 = <&spi0_sleep>;
  pinctrl-names = "default", "sleep";
};

&pinctrl {
  spi0_default: spi0_default {
    group1 {
      psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
              <NRF_PSEL(SPIM_MISO, 0, 12)>,
              <NRF_PSEL(SPIM_MOSI, 0, 11)>;
    };
  };
  spi0_sleep: spi0_sleep {
    group1 {
      psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
              <NRF_PSEL(SPIM_MISO, 0, 12)>,
              <NRF_PSEL(SPIM_MOSI, 0, 11)>;
    };
  };
};

and More…
In Zephyr look here :–>

also You can read all about it in the “Technical Reference Guide” for the Nrf52840 :+1:

HTH
GL :slight_smile: Pj :v: