64 changed files with 510 additions and 1106 deletions
@ -1,70 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#ifdef __AVR__ |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
#include "../../MarlinCore.h" |
|
||||
|
|
||||
// Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s.
|
|
||||
void watchdog_init() { |
|
||||
#if ENABLED(WATCHDOG_DURATION_8S) && defined(WDTO_8S) |
|
||||
#define WDTO_NS WDTO_8S |
|
||||
#else |
|
||||
#define WDTO_NS WDTO_4S |
|
||||
#endif |
|
||||
#if ENABLED(WATCHDOG_RESET_MANUAL) |
|
||||
// Enable the watchdog timer, but only for the interrupt.
|
|
||||
// Take care, as this requires the correct order of operation, with interrupts disabled.
|
|
||||
// See the datasheet of any AVR chip for details.
|
|
||||
wdt_reset(); |
|
||||
cli(); |
|
||||
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE); |
|
||||
_WD_CONTROL_REG = _BV(WDIE) | (WDTO_NS & 0x07) | ((WDTO_NS & 0x08) << 2); // WDTO_NS directly does not work. bit 0-2 are consecutive in the register but the highest value bit is at bit 5
|
|
||||
// So worked for up to WDTO_2S
|
|
||||
sei(); |
|
||||
wdt_reset(); |
|
||||
#else |
|
||||
wdt_enable(WDTO_NS); // The function handles the upper bit correct.
|
|
||||
#endif |
|
||||
//delay(10000); // test it!
|
|
||||
} |
|
||||
|
|
||||
//===========================================================================
|
|
||||
//=================================== ISR ===================================
|
|
||||
//===========================================================================
|
|
||||
|
|
||||
// Watchdog timer interrupt, called if main program blocks >4sec and manual reset is enabled.
|
|
||||
#if ENABLED(WATCHDOG_RESET_MANUAL) |
|
||||
ISR(WDT_vect) { |
|
||||
sei(); // With the interrupt driven serial we need to allow interrupts.
|
|
||||
SERIAL_ERROR_MSG(STR_WATCHDOG_FIRED); |
|
||||
minkill(); // interrupt-safe final kill and infinite loop
|
|
||||
} |
|
||||
#endif |
|
||||
|
|
||||
#endif // USE_WATCHDOG
|
|
||||
#endif // __AVR__
|
|
@ -1,31 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
#include <avr/wdt.h> |
|
||||
|
|
||||
// Initialize watchdog with a 4 second interrupt time
|
|
||||
void watchdog_init(); |
|
||||
|
|
||||
// Reset watchdog. MUST be called at least every 4 seconds after the
|
|
||||
// first watchdog_init or AVR will go into emergency procedures.
|
|
||||
inline void HAL_watchdog_refresh() { wdt_reset(); } |
|
@ -1,114 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#ifdef ARDUINO_ARCH_SAM |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
#include "../../MarlinCore.h" |
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
// Override Arduino runtime to either config or disable the watchdog
|
|
||||
//
|
|
||||
// We need to configure the watchdog as soon as possible in the boot
|
|
||||
// process, because watchdog initialization at hardware reset on SAM3X8E
|
|
||||
// is unreliable, and there is risk of unintended resets if we delay
|
|
||||
// that initialization to a later time.
|
|
||||
void watchdogSetup() { |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
// 4 seconds timeout
|
|
||||
uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000); |
|
||||
|
|
||||
// Calculate timeout value in WDT counter ticks: This assumes
|
|
||||
// the slow clock is running at 32.768 kHz watchdog
|
|
||||
// frequency is therefore 32768 / 128 = 256 Hz
|
|
||||
timeout = (timeout << 8) / 1000; |
|
||||
if (timeout == 0) |
|
||||
timeout = 1; |
|
||||
else if (timeout > 0xFFF) |
|
||||
timeout = 0xFFF; |
|
||||
|
|
||||
// We want to enable the watchdog with the specified timeout
|
|
||||
uint32_t value = |
|
||||
WDT_MR_WDV(timeout) | // With the specified timeout
|
|
||||
WDT_MR_WDD(timeout) | // and no invalid write window
|
|
||||
#if !(SAMV70 || SAMV71 || SAME70 || SAMS70) |
|
||||
WDT_MR_WDRPROC | // WDT fault resets processor only - We want
|
|
||||
// to keep PIO controller state
|
|
||||
#endif |
|
||||
WDT_MR_WDDBGHLT | // WDT stops in debug state.
|
|
||||
WDT_MR_WDIDLEHLT; // WDT stops in idle state.
|
|
||||
|
|
||||
#if ENABLED(WATCHDOG_RESET_MANUAL) |
|
||||
// We enable the watchdog timer, but only for the interrupt.
|
|
||||
|
|
||||
// Configure WDT to only trigger an interrupt
|
|
||||
value |= WDT_MR_WDFIEN; // Enable WDT fault interrupt.
|
|
||||
|
|
||||
// Disable WDT interrupt (just in case, to avoid triggering it!)
|
|
||||
NVIC_DisableIRQ(WDT_IRQn); |
|
||||
|
|
||||
// We NEED memory barriers to ensure Interrupts are actually disabled!
|
|
||||
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
|
|
||||
__DSB(); |
|
||||
__ISB(); |
|
||||
|
|
||||
// Initialize WDT with the given parameters
|
|
||||
WDT_Enable(WDT, value); |
|
||||
|
|
||||
// Configure and enable WDT interrupt.
|
|
||||
NVIC_ClearPendingIRQ(WDT_IRQn); |
|
||||
NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups
|
|
||||
NVIC_EnableIRQ(WDT_IRQn); |
|
||||
|
|
||||
#else |
|
||||
|
|
||||
// a WDT fault triggers a reset
|
|
||||
value |= WDT_MR_WDRSTEN; |
|
||||
|
|
||||
// Initialize WDT with the given parameters
|
|
||||
WDT_Enable(WDT, value); |
|
||||
|
|
||||
#endif |
|
||||
|
|
||||
// Reset the watchdog
|
|
||||
WDT_Restart(WDT); |
|
||||
|
|
||||
#else |
|
||||
|
|
||||
// Make sure to completely disable the Watchdog
|
|
||||
WDT_Disable(WDT); |
|
||||
|
|
||||
#endif |
|
||||
} |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
// Initialize watchdog - On SAM3X, Watchdog was already configured
|
|
||||
// and enabled or disabled at startup, so no need to reconfigure it
|
|
||||
// here.
|
|
||||
void watchdog_init() { |
|
||||
// Reset watchdog to start clean
|
|
||||
WDT_Restart(WDT); |
|
||||
} |
|
||||
#endif // USE_WATCHDOG
|
|
||||
|
|
||||
#endif |
|
@ -1,33 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
// Arduino Due core now has watchdog support
|
|
||||
|
|
||||
#include "HAL.h" |
|
||||
|
|
||||
// Initialize watchdog with a 4 second interrupt time
|
|
||||
void watchdog_init(); |
|
||||
|
|
||||
// Reset watchdog. MUST be called at least every 4 seconds after the
|
|
||||
// first watchdog_init or AVR will go into emergency procedures.
|
|
||||
inline void HAL_watchdog_refresh() { watchdogReset(); } |
|
@ -1,42 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#ifdef ARDUINO_ARCH_ESP32 |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
|
||||
|
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
void watchdogSetup() { |
|
||||
// do whatever. don't remove this function.
|
|
||||
} |
|
||||
|
|
||||
void watchdog_init() { |
|
||||
// TODO
|
|
||||
} |
|
||||
|
|
||||
#endif // USE_WATCHDOG
|
|
||||
|
|
||||
#endif // ARDUINO_ARCH_ESP32
|
|
@ -1,38 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
#ifdef __cplusplus |
|
||||
extern "C" { |
|
||||
#endif |
|
||||
|
|
||||
esp_err_t esp_task_wdt_reset(); |
|
||||
|
|
||||
#ifdef __cplusplus |
|
||||
} |
|
||||
#endif |
|
||||
|
|
||||
// Initialize watchdog with a 4 second interrupt time
|
|
||||
void watchdog_init(); |
|
||||
|
|
||||
// Reset watchdog.
|
|
||||
inline void HAL_watchdog_refresh() { esp_task_wdt_reset(); } |
|
@ -1,37 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#ifdef __PLAT_LINUX__ |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
|
||||
|
|
||||
void watchdog_init() {} |
|
||||
void HAL_watchdog_refresh() {} |
|
||||
|
|
||||
#endif |
|
||||
|
|
||||
#endif // __PLAT_LINUX__
|
|
@ -1,25 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
void watchdog_init(); |
|
||||
void HAL_watchdog_refresh(); |
|
@ -1,72 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#ifdef TARGET_LPC1768 |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#include <lpc17xx_wdt.h> |
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
|
||||
|
|
||||
void watchdog_init() { |
|
||||
#if ENABLED(WATCHDOG_RESET_MANUAL) |
|
||||
// We enable the watchdog timer, but only for the interrupt.
|
|
||||
|
|
||||
// Configure WDT to only trigger an interrupt
|
|
||||
// Disable WDT interrupt (just in case, to avoid triggering it!)
|
|
||||
NVIC_DisableIRQ(WDT_IRQn); |
|
||||
|
|
||||
// We NEED memory barriers to ensure Interrupts are actually disabled!
|
|
||||
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
|
|
||||
__DSB(); |
|
||||
__ISB(); |
|
||||
|
|
||||
// Configure WDT to only trigger an interrupt
|
|
||||
// Initialize WDT with the given parameters
|
|
||||
WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_INT_ONLY); |
|
||||
|
|
||||
// Configure and enable WDT interrupt.
|
|
||||
NVIC_ClearPendingIRQ(WDT_IRQn); |
|
||||
NVIC_SetPriority(WDT_IRQn, 0); // Use highest priority, so we detect all kinds of lockups
|
|
||||
NVIC_EnableIRQ(WDT_IRQn); |
|
||||
#else |
|
||||
WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET); |
|
||||
#endif |
|
||||
WDT_Start(WDT_TIMEOUT_US); |
|
||||
} |
|
||||
|
|
||||
void HAL_watchdog_refresh() { |
|
||||
WDT_Feed(); |
|
||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) |
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
|
||||
#endif |
|
||||
} |
|
||||
|
|
||||
// Timeout state
|
|
||||
bool watchdog_timed_out() { return TEST(WDT_ReadTimeOutFlag(), 0); } |
|
||||
void watchdog_clear_timeout_flag() { WDT_ClrTimeOutFlag(); } |
|
||||
|
|
||||
#endif // USE_WATCHDOG
|
|
||||
#endif // TARGET_LPC1768
|
|
@ -1,28 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
void watchdog_init(); |
|
||||
void HAL_watchdog_refresh(); |
|
||||
|
|
||||
bool watchdog_timed_out(); |
|
||||
void watchdog_clear_timeout_flag(); |
|
@ -1,27 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
#define WDT_TIMEOUT 4000000 // 4 second timeout
|
|
||||
|
|
||||
void watchdog_init(); |
|
||||
void HAL_watchdog_refresh(); |
|
@ -1,54 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#ifdef __SAMD51__ |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
#define WDT_TIMEOUT_REG TERN(WATCHDOG_DURATION_8S, WDT_CONFIG_PER_CYC8192, WDT_CONFIG_PER_CYC4096) // 4 or 8 second timeout
|
|
||||
|
|
||||
void watchdog_init() { |
|
||||
// The low-power oscillator used by the WDT runs at 32,768 Hz with
|
|
||||
// a 1:32 prescale, thus 1024 Hz, though probably not super precise.
|
|
||||
|
|
||||
// Setup WDT clocks
|
|
||||
MCLK->APBAMASK.bit.OSC32KCTRL_ = true; |
|
||||
MCLK->APBAMASK.bit.WDT_ = true; |
|
||||
OSC32KCTRL->OSCULP32K.bit.EN1K = true; // Enable out 1K (this is what WDT uses)
|
|
||||
|
|
||||
WDT->CTRLA.bit.ENABLE = false; // Disable watchdog for config
|
|
||||
SYNC(WDT->SYNCBUSY.bit.ENABLE); |
|
||||
|
|
||||
WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt
|
|
||||
WDT->CONFIG.reg = WDT_TIMEOUT_REG; // Set a 4s or 8s period for chip reset
|
|
||||
|
|
||||
HAL_watchdog_refresh(); |
|
||||
|
|
||||
WDT->CTRLA.reg = WDT_CTRLA_ENABLE; // Start watchdog now in normal mode
|
|
||||
SYNC(WDT->SYNCBUSY.bit.ENABLE); |
|
||||
} |
|
||||
|
|
||||
#endif // USE_WATCHDOG
|
|
||||
|
|
||||
#endif // __SAMD51__
|
|
@ -1,31 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* SAMD51 HAL developed by Giuliano Zaro (AKA GMagician) |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
// Initialize watchdog with a 4 second interrupt time
|
|
||||
void watchdog_init(); |
|
||||
|
|
||||
// Reset watchdog. MUST be called at least every 4 seconds after the
|
|
||||
// first watchdog_init or SAMD will go into emergency procedures.
|
|
||||
inline void HAL_watchdog_refresh() { |
|
||||
SYNC(WDT->SYNCBUSY.bit.CLEAR); // Test first if previous is 'ongoing' to save time waiting for command execution
|
|
||||
WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY; |
|
||||
} |
|
@ -1,52 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
#include "../platforms.h" |
|
||||
|
|
||||
#ifdef HAL_STM32 |
|
||||
|
|
||||
#include "../../inc/MarlinConfigPre.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#include "watchdog.h" |
|
||||
#include <IWatchdog.h> |
|
||||
|
|
||||
void watchdog_init() { |
|
||||
#if DISABLED(DISABLE_WATCHDOG_INIT) |
|
||||
IWatchdog.begin(WDT_TIMEOUT_US); |
|
||||
#endif |
|
||||
} |
|
||||
|
|
||||
void HAL_watchdog_refresh() { |
|
||||
IWatchdog.reload(); |
|
||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) |
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
|
||||
#endif |
|
||||
} |
|
||||
|
|
||||
#endif // USE_WATCHDOG
|
|
||||
#endif // HAL_STM32
|
|
@ -1,25 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
void watchdog_init(); |
|
||||
void HAL_watchdog_refresh(); |
|
@ -1,66 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
/**
|
|
||||
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1) |
|
||||
*/ |
|
||||
|
|
||||
#ifdef __STM32F1__ |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#include <libmaple/iwdg.h> |
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
/**
|
|
||||
* The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0). |
|
||||
*/ |
|
||||
#define STM32F1_WD_RELOAD TERN(WATCHDOG_DURATION_8S, 1250, 625) // 4 or 8 second timeout
|
|
||||
|
|
||||
void HAL_watchdog_refresh() { |
|
||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED) |
|
||||
TOGGLE(LED_PIN); // heartbeat indicator
|
|
||||
#endif |
|
||||
iwdg_feed(); |
|
||||
} |
|
||||
|
|
||||
void watchdogSetup() { |
|
||||
// do whatever. don't remove this function.
|
|
||||
} |
|
||||
|
|
||||
/**
|
|
||||
* @brief Initialized the independent hardware watchdog. |
|
||||
* |
|
||||
* @return No return |
|
||||
* |
|
||||
* @details The watchdog clock is 40Khz. So for a 4s or 8s interval use a /256 preescaler and 625 or 1250 reload value (counts down to 0). |
|
||||
*/ |
|
||||
void watchdog_init() { |
|
||||
#if DISABLED(DISABLE_WATCHDOG_INIT) |
|
||||
iwdg_init(IWDG_PRE_256, STM32F1_WD_RELOAD); |
|
||||
#endif |
|
||||
} |
|
||||
|
|
||||
#endif // USE_WATCHDOG
|
|
||||
#endif // __STM32F1__
|
|
@ -1,35 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
/**
|
|
||||
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1) |
|
||||
*/ |
|
||||
|
|
||||
#include <libmaple/iwdg.h> |
|
||||
|
|
||||
// Initialize watchdog with a 4 or 8 second countdown time
|
|
||||
void watchdog_init(); |
|
||||
|
|
||||
// Reset watchdog. MUST be called every 4 or 8 seconds after the
|
|
||||
// first watchdog_init or the STM32F1 will reset.
|
|
||||
void HAL_watchdog_refresh(); |
|
@ -1,40 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#ifdef __MK20DX256__ |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout
|
|
||||
|
|
||||
void watchdog_init() { |
|
||||
WDOG_TOVALH = 0; |
|
||||
WDOG_TOVALL = WDT_TIMEOUT_MS; |
|
||||
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN; |
|
||||
} |
|
||||
|
|
||||
#endif // USE_WATCHDOG
|
|
||||
|
|
||||
#endif // __MK20DX256__
|
|
@ -1,34 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
#include "HAL.h" |
|
||||
|
|
||||
// Arduino Due core now has watchdog support
|
|
||||
|
|
||||
void watchdog_init(); |
|
||||
|
|
||||
inline void HAL_watchdog_refresh() { |
|
||||
// Watchdog refresh sequence
|
|
||||
WDOG_REFRESH = 0xA602; |
|
||||
WDOG_REFRESH = 0xB480; |
|
||||
} |
|
@ -1,40 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
#define WDT_TIMEOUT_MS TERN(WATCHDOG_DURATION_8S, 8000, 4000) // 4 or 8 second timeout
|
|
||||
|
|
||||
void watchdog_init() { |
|
||||
WDOG_TOVALH = 0; |
|
||||
WDOG_TOVALL = WDT_TIMEOUT_MS; |
|
||||
WDOG_STCTRLH = WDOG_STCTRLH_WDOGEN; |
|
||||
} |
|
||||
|
|
||||
#endif // USE_WATCHDOG
|
|
||||
|
|
||||
#endif // __MK64FX512__ || __MK66FX1M0__
|
|
@ -1,30 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
void watchdog_init(); |
|
||||
|
|
||||
inline void HAL_watchdog_refresh() { |
|
||||
// Watchdog refresh sequence
|
|
||||
WDOG_REFRESH = 0xA602; |
|
||||
WDOG_REFRESH = 0xB480; |
|
||||
} |
|
@ -1,52 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#ifdef __IMXRT1062__ |
|
||||
|
|
||||
/**
|
|
||||
* HAL Watchdog for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) |
|
||||
*/ |
|
||||
|
|
||||
#include "../../inc/MarlinConfig.h" |
|
||||
|
|
||||
#if ENABLED(USE_WATCHDOG) |
|
||||
|
|
||||
#include "watchdog.h" |
|
||||
|
|
||||
#define WDT_TIMEOUT TERN(WATCHDOG_DURATION_8S, 8, 4) // 4 or 8 second timeout
|
|
||||
|
|
||||
constexpr uint8_t timeoutval = (WDT_TIMEOUT - 0.5f) / 0.5f; |
|
||||
|
|
||||
void watchdog_init() { |
|
||||
CCM_CCGR3 |= CCM_CCGR3_WDOG1(3); // enable WDOG1 clocks
|
|
||||
WDOG1_WMCR = 0; // disable power down PDE
|
|
||||
WDOG1_WCR |= WDOG_WCR_SRS | WDOG_WCR_WT(timeoutval); |
|
||||
WDOG1_WCR |= WDOG_WCR_WDE | WDOG_WCR_WDT | WDOG_WCR_SRE; |
|
||||
} |
|
||||
|
|
||||
void HAL_watchdog_refresh() { |
|
||||
// Watchdog refresh sequence
|
|
||||
WDOG1_WSR = 0x5555; |
|
||||
WDOG1_WSR = 0xAAAA; |
|
||||
} |
|
||||
|
|
||||
#endif // USE_WATCHDOG
|
|
||||
#endif // __IMXRT1062__
|
|
@ -1,30 +0,0 @@ |
|||||
/**
|
|
||||
* Marlin 3D Printer Firmware |
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||
* |
|
||||
* Based on Sprinter and grbl. |
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
*/ |
|
||||
#pragma once |
|
||||
|
|
||||
/**
|
|
||||
* HAL Watchdog for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) |
|
||||
*/ |
|
||||
|
|
||||
void watchdog_init(); |
|
||||
|
|
||||
void HAL_watchdog_refresh(); |
|
Loading…
Reference in new issue