SPI.transfer() hangs #2633
-
I am about to use SPI module with my Arduino sketch, but what I noticed that SPI.transfer() hangs for some reason. Here is my sketch: void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
SPI.begin();
Serial.println("aa"); // I can see this message
SPI.transfer(0);
Serial.println("bb"); // I don't see this message
} I can see the "aa" in the output, but not the "bb" - apparently What am I doing wrong? Advice would be much appreciated. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In most modern Arduinos, you need to use SPI transactions. Try adding |
Beta Was this translation helpful? Give feedback.
In most modern Arduinos, you need to use SPI transactions. Try adding
SPI.beginTransaction()
andspi.endTransaction()
calls around the transfer(s).