Hello,
When changing data mode with SPI.beginTransaction(), the clock output is not set to the right level, which can cause issues. For example from mode 3 (idle clock level is high) to mode 0 (idle clock level is low), the clock stay high before the first SPI.transfert() and causes a unwanted falling edge and (some?) devices doesn't like that.
Here is a screenshot: (notice the glitch too)

And the associated code:
// SPI transaction in mode 3...
...
SPI.beginTransaction(SPISettings(1000000UL, MSBFIRST, SPI_MODE0));
delayMicroseconds(5); // Just to differentiate the glitch
SPI.transfer(0x40);
SPI.endTransaction();
That is for mode 3 to mode 0, but same deal for the reverse order.
The only workaround I found is to shift a dummy byte without any chip selected before doing the "real" transaction.
Tested with Teensy 3.6 & 3.2.
Hello,
When changing data mode with SPI.beginTransaction(), the clock output is not set to the right level, which can cause issues. For example from mode 3 (idle clock level is high) to mode 0 (idle clock level is low), the clock stay high before the first SPI.transfert() and causes a unwanted falling edge and (some?) devices doesn't like that.
Here is a screenshot: (notice the glitch too)
And the associated code:
That is for mode 3 to mode 0, but same deal for the reverse order.
The only workaround I found is to shift a dummy byte without any chip selected before doing the "real" transaction.
Tested with Teensy 3.6 & 3.2.