diff --git a/Marlin/src/HAL/DUE/HAL.cpp b/Marlin/src/HAL/DUE/HAL.cpp index d1db9148c4..9b3cf1a516 100644 --- a/Marlin/src/HAL/DUE/HAL.cpp +++ b/Marlin/src/HAL/DUE/HAL.cpp @@ -102,6 +102,10 @@ void watchdogSetup() { #if ENABLED(USE_WATCHDOG) + #ifndef WATCHDOG_PIO_RESET + #define WATCHDOG_PIO_RESET + #endif + // 4 seconds timeout uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000); @@ -115,15 +119,16 @@ void watchdogSetup() { 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. + uint32_t value = (0 + | WDT_MR_WDV(timeout) // With the specified timeout + | WDT_MR_WDD(timeout) // and no invalid write window + #if NONE(WATCHDOG_PIO_RESET, SAMV70, SAMV71, SAME70, SAMS70) + | WDT_MR_WDRPROC // WDT fault resets processor only with this flag. + // Omit to also reset the PIO controller. + #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. diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index dcb8415de8..8c974cce48 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -516,33 +516,33 @@ // #elif MB(DUE3DOM) - #include "sam/pins_DUE3DOM.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_DUE3DOM.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(DUE3DOM_MINI) - #include "sam/pins_DUE3DOM_MINI.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_DUE3DOM_MINI.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RADDS) - #include "sam/pins_RADDS.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RADDS.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS_FD_V1) - #include "sam/pins_RAMPS_FD_V1.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_FD_V1.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS_FD_V2) - #include "sam/pins_RAMPS_FD_V2.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_FD_V2.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF) - #include "sam/pins_RAMPS_SMART.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_SMART.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS_DUO_EFB, RAMPS_DUO_EEB, RAMPS_DUO_EFF, RAMPS_DUO_EEF, RAMPS_DUO_SF) - #include "sam/pins_RAMPS_DUO.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_DUO.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RAMPS4DUE_EFB, RAMPS4DUE_EEB, RAMPS4DUE_EFF, RAMPS4DUE_EEF, RAMPS4DUE_SF) - #include "sam/pins_RAMPS4DUE.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS4DUE.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RURAMPS4D_11) - #include "sam/pins_RURAMPS4D_11.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RURAMPS4D_11.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(RURAMPS4D_13) - #include "sam/pins_RURAMPS4D_13.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RURAMPS4D_13.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(ULTRATRONICS_PRO) - #include "sam/pins_ULTRATRONICS_PRO.h" // SAM3X8E env:DUE env:DUE_debug + #include "sam/pins_ULTRATRONICS_PRO.h" // SAM3X8E env:DUE #elif MB(ARCHIM1) - #include "sam/pins_ARCHIM1.h" // SAM3X8E env:DUE_archim env:DUE_archim_debug + #include "sam/pins_ARCHIM1.h" // SAM3X8E env:DUE_archim #elif MB(ARCHIM2) - #include "sam/pins_ARCHIM2.h" // SAM3X8E env:DUE_archim env:DUE_archim_debug + #include "sam/pins_ARCHIM2.h" // SAM3X8E env:DUE_archim #elif MB(ALLIGATOR) - #include "sam/pins_ALLIGATOR_R2.h" // SAM3X8E env:DUE env:DUE_debug + #include "sam/pins_ALLIGATOR_R2.h" // SAM3X8E env:DUE #elif MB(CNCONTROLS_15D) #include "sam/pins_CNCONTROLS_15D.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(KRATOS32) @@ -555,7 +555,7 @@ #elif MB(PRINTRBOARD_G2) #include "sam/pins_PRINTRBOARD_G2.h" // SAM3X8C env:DUE_USB #elif MB(ADSK) - #include "sam/pins_ADSK.h" // SAM3X8C env:DUE env:DUE_debug + #include "sam/pins_ADSK.h" // SAM3X8C env:DUE // // STM32 ARM Cortex-M0+ diff --git a/buildroot/share/PlatformIO/boards/marlin_archim.json b/buildroot/share/PlatformIO/boards/marlin_archim.json index 6d78c1f195..ee2ebd62ad 100644 --- a/buildroot/share/PlatformIO/boards/marlin_archim.json +++ b/buildroot/share/PlatformIO/boards/marlin_archim.json @@ -2,7 +2,7 @@ "build": { "core": "arduino", "cpu": "cortex-m3", - "extra_flags": "-D__SAM3X8E__ -DARDUINO_ARCH_SAM -DARDUINO_SAM_DUE", + "extra_flags": "-D__SAM3X8E__ -DARDUINO_SAM_DUE -DARDUINO_SAM_ARCHIM", "f_cpu": "84000000L", "hwids": [ [ diff --git a/ini/due.ini b/ini/due.ini index c1e2375d7c..7e4017e257 100644 --- a/ini/due.ini +++ b/ini/due.ini @@ -19,6 +19,7 @@ platform = atmelsam board = due build_src_filter = ${common.default_src_filter} + + +build_flags = -DWATCHDOG_PIO_RESET [env:DUE_USB] extends = env:DUE @@ -27,14 +28,9 @@ board = dueUSB # # Archim SAM # -[common_DUE_archim] +[env:DUE_archim] extends = env:DUE board = marlin_archim -build_flags = ${common.build_flags} - -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSBCON board_build.variants_dir = buildroot/share/PlatformIO/variants/ extra_scripts = ${common.extra_scripts} - Marlin/src/HAL/DUE/upload_extra_script.py - -[env:DUE_archim] -extends = common_DUE_archim + Marlin/src/HAL/DUE/upload_extra_script.py