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);
}