Browse Source

Merge pull request #5681 from thinkyhead/rc_prevent_boot_loop

Reset watchdog in SD init to prevent reboot
pull/1/head
Scott Lahteine 8 years ago
committed by GitHub
parent
commit
7a9c1a279b
  1. 10
      Marlin/Sd2Card.cpp

10
Marlin/Sd2Card.cpp

@ -31,6 +31,10 @@
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "Sd2Card.h" #include "Sd2Card.h"
#if ENABLED(USE_WATCHDOG)
#include "watchdog.h"
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if DISABLED(SOFTWARE_SPI) #if DISABLED(SOFTWARE_SPI)
// functions for hardware SPI // functions for hardware SPI
@ -299,6 +303,12 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
uint16_t t0 = (uint16_t)millis(); uint16_t t0 = (uint16_t)millis();
uint32_t arg; uint32_t arg;
// If init takes more than 4s it could trigger
// watchdog leading to a reboot loop.
#if ENABLED(USE_WATCHDOG)
watchdog_reset();
#endif
// set pin modes // set pin modes
pinMode(chipSelectPin_, OUTPUT); pinMode(chipSelectPin_, OUTPUT);
chipSelectHigh(); chipSelectHigh();

Loading…
Cancel
Save