Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI beginTransaction doesn't set outputs level #26

Open
GIPdA opened this issue May 19, 2017 · 0 comments
Open

SPI beginTransaction doesn't set outputs level #26

GIPdA opened this issue May 19, 2017 · 0 comments

Comments

@GIPdA
Copy link

GIPdA commented May 19, 2017

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)

sds00001

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant