Various fixes for DUE... (#10152)

- Watchdog reset during SD Card initialization.
- Move `DebugMonitor` to `DebugMonitor_Due.cpp`.
- Since the watchdog is enabled on boot do extra resets during init.
- Have `thermalManager` do watchdog reset before its ISR starts to prevent reset.
- Ensure that timers are stopped before reprogramming them to address tone issues.
- Improve SAM3XE reset when reflashed through the native port.
This commit is contained in:
Eduardo José Tagle
2018-03-21 21:04:45 -03:00
committed by Scott Lahteine
parent c3c264978f
commit 97e8a6ebd9
23 changed files with 441 additions and 60 deletions

View File

@ -260,6 +260,11 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) {
// must supply min of 74 clock cycles with CS high.
for (uint8_t i = 0; i < 10; i++) spiSend(0xFF);
// Initialization can cause the watchdog to timeout, so reinit it here
#if ENABLED(USE_WATCHDOG)
watchdog_reset();
#endif
// command to go idle in SPI mode
while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) {
if (((uint16_t)millis() - t0) > SD_INIT_TIMEOUT) {
@ -272,6 +277,11 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) {
crcSupported = (cardCommand(CMD59, 1) == R1_IDLE_STATE);
#endif
// Initialization can cause the watchdog to timeout, so reinit it here
#if ENABLED(USE_WATCHDOG)
watchdog_reset();
#endif
// check SD version
for (;;) {
if (cardCommand(CMD8, 0x1AA) == (R1_ILLEGAL_COMMAND | R1_IDLE_STATE)) {
@ -292,6 +302,11 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) {
}
}
// Initialization can cause the watchdog to timeout, so reinit it here
#if ENABLED(USE_WATCHDOG)
watchdog_reset();
#endif
// initialize card and send host supports SDHC if SD2
arg = type() == SD_CARD_TYPE_SD2 ? 0x40000000 : 0;
while ((status_ = cardAcmd(ACMD41, arg)) != R1_READY_STATE) {