File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -433,7 +433,15 @@ void MCP2515Class::reset()
433433 digitalWrite (_csPin, HIGH);
434434 SPI.endTransaction ();
435435
436- delayMicroseconds (10 );
436+ // 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 (160 * 1000000.0 / _clockFrequency));
437445}
438446
439447void MCP2515Class::handleInterrupt ()
You can’t perform that action at this time.
0 commit comments