What specific devices are connected?
If you can show me a sketch of what you are running, I can try it in my environment.
#include <SPI.h>
// define Xiao CS
#define CS 7
SPISettings settings(1000000, MSBFIRST, SPI_MODE0);
void setup() {
Serial.begin(9600);
SPI.begin();
pinMode(CS,OUTPUT);
digitalWrite(CS, HIGH);
}
void loop() {
SPI.beginTransaction(settings);
digitalWrite(CS, LOW);
SPI.transfer(0x00); // Address to read from peripheral
SPI.transfer(0x80); // Byte signalling read instruction to peripheral
uint8_t readByte = SPI.transfer(0xFF); // Sent DONT CARE byte and receive peripheral data
digitalWrite(CS, HIGH);
Serial.print(“0x”);
Serial.println(readByte, HEX);
delay(10);
SPI.endTransaction();
delay(1000);
}
Try this.
#define CS D7
Compare the two variants.
\Arduino15\packages\Seeeduino\hardware\mbed\2.9.2\variants\SEEED_XIAO_NRF52840\pins_arduino.h LINE82
\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.9\variants\Seeed_XIAO_nRF52840\variant.h LINE45
Tried the change, but the SPI communication is still freezing. On my logic analyzer, I see the CS is going active LOW as intended, but the device freezes on SPI.transfer(). When I disconnect my SCK connection, the Xiao leaves the frozen state and prints out “0x0”.
What devices are you connecting to XIAO?
Can you post the waveforms from the logic analyzer?
The only SPI device I can prepare is an SD card drive or a BMP388 pressure sensor. I will check the waveforms.
I have a previous post reporting on mbed and non-mbed SPI. It might be helpful.
For BMP388, the following will read 0x50 of ChipID for both mbed and non-mbed.
//SPI.transfer(0x00); // Address to read from peripheral
//SPI.transfer(0x80); // Byte signalling read instruction to peripheral
SPI.transfer(0x80); // Address to read from peripheral
SPI.transfer(0x00); // Byte signalling read instruction to peripheral
Ok, thanks for your test.
I was able to switch my bluetooth over from ArduinoBLE to bluefruit, so now I’ll be on the non-mbed. I may go back later and probe my mbed SPI more, but for now I found something that works for my project.
Thanks again for helping troubleshoot this!
Hi there,
Probably the best example of a screen snap representingthe issue SO clearly.
What O-scope are you using my guy?
I bet I’m not the only one who wants to know Either
Produces very nice waveforms, I got a new “Siglent 1104X-E” I haven’t turned it on Yet! LOL… contemplating UPDATING the firmware to Enable some extra BW and options.
Tools often change but scopes are a bedrock, I have used so many at Black Box Data-Comm, CMU _SEI. my first was a Hameg LOL, heath-kit ,I loved my little B&K I had back in the day, but the Techtronic’s and HP took over, NOW soup to nuts out there with the Super High End $$$ being designer type now. Rohde & Schwarz, teledyne LeCroy .
I’m a Keysite and Siglent curious now
TIA
GL PJ
When I was younger, I spent my days chasing single glitches with a Tektronix memory scope. What I chase now is I2C and SPI out of the XIAO can, so RIGOL’s DS1054 is sufficient.