Skip to content

Commit

Permalink
Added 2 ms delay after RESET via SPI
Browse files Browse the repository at this point in the history
  • Loading branch information
pierremolinaro committed Apr 7, 2023
1 parent 91a5c59 commit 5ae235d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Binary file modified extras/acan2515.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ACAN2515
version=2.1.1
version=2.1.2
author=Pierre Molinaro
maintainer=Pierre Molinaro <[email protected]>
sentence=Driver for MCP2515 CAN Controller
Expand Down
15 changes: 12 additions & 3 deletions src/ACAN2515.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,19 @@ uint16_t ACAN2515::beginWithoutFilterCheck (const ACAN2515Settings & inSettings,
mSPI.transfer (RESET_COMMAND) ;
unselect () ;
mSPI.endTransaction () ;
//---
delayMicroseconds (10) ;
//--- DS20001801J, page 55: The Oscillator Start-up Timer keeps the device in a Reset
// state for 128 OSC1 clock cycles after the occurrence of a Power-on Reset, SPI Reset,
// after the assertion of the RESET pin, and after a wake-up from Sleep mode
// Fot a 1 MHz clock --> 128 µs
// So delayMicroseconds (10) is too short --> use delay (2)
// delayMicroseconds (10) ; // Removed in release 2.1.2
delay (2) ; // Added in release 2.1.2
//--- Internal begin
errorCode = internalBeginOperation (inSettings, inRXM0, inRXM1, inAcceptanceFilters, inAcceptanceFilterCount) ;
errorCode = internalBeginOperation (inSettings,
inRXM0,
inRXM1,
inAcceptanceFilters,
inAcceptanceFilterCount) ;
}
//--- Configure interrupt only if no error (thanks to mvSarma)
if (errorCode == 0) {
Expand Down

0 comments on commit 5ae235d

Please sign in to comment.