We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bcdd7ac commit 344d70eCopy full SHA for 344d70e
src/MCP2515.cpp
@@ -433,7 +433,15 @@ void MCP2515Class::reset()
433
digitalWrite(_csPin, HIGH);
434
SPI.endTransaction();
435
436
- delayMicroseconds(10);
+ // From the data sheet:
437
+ // The OST keeps the device in a Reset state for 128 OSC1 clock cycles after
438
+ // the occurrence of a Power-on Reset, SPI Reset, after the assertion of the
439
+ // RESET pin, and after a wake-up from Sleep mode. It should be noted that no
440
+ // SPI protocol operations should be attempted until after the OST has
441
+ // expired.
442
+ // We sleep for 160 cycles to match the old behavior with 16 MHz quartz, and
443
+ // to be on the safe side for 8 MHz devices.
444
+ delayMicroseconds(ceil(128 * 1000000.0 / _clockFrequency));
445
}
446
447
void MCP2515Class::handleInterrupt()
0 commit comments