Categories

SPI Transactions in Arduino

Posted on Thursday, July 31st, 2014 in Arduino by DP

scope

Paul over at DorkbotPDX writes:

For the last several weeks, I’ve been working on SPI transactions for Arduino’s SPI library, to solve conflicts that sometimes occur between multiple SPI devices when using SPI from interrupts and/or different SPI settings.
To explain, a picture is worth 1000 works. In this screenshot, loop() repetitively sends 2 bytes, where green is its chip select and red is the SPI clock. Blue is the interrupt signal (rising edge) from a wireless module. In this test, the interrupt happens at just the worst moment, during the first byte while loop() is using the SPI bus!
Without transactions, the wireless lib interrupt would immediately assert (active low) the yellow chip select while the green is still active low, then begin sending its data with both devices listening!

This entry was posted on Thursday, July 31st, 2014 at 9:00 pm and is filed under Arduino. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

One Response to “SPI Transactions in Arduino”

  1. MizKaBOOM says:

    Currently working on a project requiring the use of interrupts and multiple SPI devices. Arduino Mega 2560 is what I am currently using. Specifically using digital potentiometer connected via SPI and OLED. OLED had to be re-initialized after the use of SPI.end(). The digital potentiometer is set using interrupts. Luckily was able to resolve many buggy issues I have across so far with the OLED using timer functions.

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • lostengineer: hahaha an entire article just saying to heat-shrink your wires or glue them if they might move around a lot. When did common sense die?
  • readybrek: They're tasty tasty very very tasty... they're very tasty.
  • hli: Sunday++
  • Chamod: Check on your buddy. Make sure they don't forget their lunchbox.
  • Kurt: But February made me shiver With every paper I'd deliver Bad news on the doorstep I couldn't take one more step