Hi there,
I've got a project I've transferred from Arduino to the Teensy 3.2. It has six SPI devices on the bus, of which half are SPI mode 1, and the other half are SPI mode 3. This change in clock polarity wasn't an issue on the Arduino.. but on the Teensy it appears to be. My logic analyzer is telling me the clock remains low after the devices with mode 1 & 2 finish talking to the Teensy, and it corrects only a quarter of the way through the first cycle of the new clock. This confuses the mode 3 device and it's ignoring the first packet it receives.
Putting the logic analyzer on the Arduino, it's clear that it checks and if necessary corrects the polarity as soon as SPI.beginTransaction(settings) is called. Even if I add a delay between the SPI.beginTransaction(settings) and the digitalWrite(SS) command, this doesn't make a change. It seems the Teensy waits until the clock actually starts before it checks if it's the correct polarity.
Interestingly, it seems to be fine converting the polarity the other way. There's a little setup time, not much, but enough for those devices (they're faster devices - 20MHz against the 1MHz of the mode 3 devices).
Is there a way to force SPI on the Teensy to check the clock polarity as part of the setup?
Thanks in advance!
I've got a project I've transferred from Arduino to the Teensy 3.2. It has six SPI devices on the bus, of which half are SPI mode 1, and the other half are SPI mode 3. This change in clock polarity wasn't an issue on the Arduino.. but on the Teensy it appears to be. My logic analyzer is telling me the clock remains low after the devices with mode 1 & 2 finish talking to the Teensy, and it corrects only a quarter of the way through the first cycle of the new clock. This confuses the mode 3 device and it's ignoring the first packet it receives.
Putting the logic analyzer on the Arduino, it's clear that it checks and if necessary corrects the polarity as soon as SPI.beginTransaction(settings) is called. Even if I add a delay between the SPI.beginTransaction(settings) and the digitalWrite(SS) command, this doesn't make a change. It seems the Teensy waits until the clock actually starts before it checks if it's the correct polarity.
Interestingly, it seems to be fine converting the polarity the other way. There's a little setup time, not much, but enough for those devices (they're faster devices - 20MHz against the 1MHz of the mode 3 devices).
Is there a way to force SPI on the Teensy to check the clock polarity as part of the setup?
Thanks in advance!