Commit 09f46d0
committed
Add missing call to SPI.usingInterrupt()
The RFM69 driver accesses SPI in interrupt context. This can (and does)
cause a lockup if another SPI device is being accessed in non-interrupt
context at the moment that the RFM69 interrupt occurs.
I had this problem on a board with both an Ethernet2 device and an RFM69
device. Occasionally, the SPI interface would lock up hard, crashing
the application.
The fix is simple. One must call SPI.usingInterrupt() and pass in the
interrupt number during setup. The SPI library will record that fact,
and will automatically disable the interrupt whenever the SPI interface
is busy.
More information is available here:
arduino/Arduino#2381
Please note that this is a race condition, and is somewhat hard to
trigger. You need a board with several active SPI devices, and the
timing has to be such that interrupts happen in the middle of other SPI
transactions.1 parent 2da600e commit 09f46d0
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
0 commit comments