Using external SPI (P0_11, P0_28, P0_27) on Nicla Sense ME

I am trying to communicate with an external SPI IC using P0_11, P0_28, P0_27 SPI1_EXT

I tested the code below on an Nano 33 BLE and it works, but on the Nicla Sense ME it does not work. No SPI CLK output and no data output. Looking at the schematic SPI1 is shared with both the BHI260AP and the ANNA-B112.

What is needed to get an external SPI IC working with the Nicla Sense ME?

#include "Nicla_System.h"
#include <SPI.h>
#include "Arduino_BHY2.h"
#define chipSelectPin p29 //p10

void setup() {
  pinMode(chipSelectPin, OUTPUT);
  nicla::begin();    
  Serial.begin(115200);
  BHY2.begin();
  SPI.begin();
  SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE3)); // 2 MHz, MSB first, mode 3
}

void loop() {
  digitalWrite(chipSelectPin, LOW); //pull down the CS pin
  SPI.transfer(0xB7); // address for device, for example 0x00
  SPI.transfer(0x03); // value to write
  digitalWrite(chipSelectPin, HIGH); // pull up the CS pin
  delay(10);
}

Dear Haintz,
I have a very similar problem and no solution yet: Nicla Vision minimum example for SPI communication with BME280 fails - #4 by ahkub

I suspect that the SPI implemention in the Arduino Mbed OS libraries is different from the generic Arduino library.

Best, Ahkub

Hi Haintz,
Please see here if this helps: Fixed! - Nicla Vision minimum example for SPI communication with BME280 fails - #5 by ahkub
I had the name of the Chip Select Pin wrong. "PIN_SPI_SS" seems to do the trick.
Best, ahkub