I can't see what I'm doing wrong here, I get the feeling I'm missing something obvious.
Teensy4.1, Arduino IDE 2.0.4
Code:
#include <SPI.h>
int count;
void setup() {
delay(1000);
count = 0;
}
void loop() {
Serial.printf("Loop %d\r\n",++count);
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));
if (count == 10)
SPI.transfer(0xff);
SPI.endTransaction();
delay(1000);
}
Gives the result
Code:
Loop 1
Loop 2
Loop 3
Loop 4
Loop 5
Loop 6
Loop 7
Loop 8
Loop 9
Loop 10
and then locks up. No matter what I do the system dies as soon as I call SPI.transfer()
SPI1 and SPI2 show exactly the same results as SPI.
Please tell me what stupid mistake I'm making because everything I can find says this should work.