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

@@ -56,7 +56,7 @@
static volatile bool main_b_cdc_enable = false;
static volatile bool main_b_dtr_active = false;
void HAL_idletask(void) {
void usb_task_idle(void) {
#if ENABLED(SDSUPPORT)
// Attend SD card access from the USB MSD -- Prioritize access to improve speed
int delay = 2;
@@ -107,8 +107,15 @@ void usb_task_cdc_set_dtr(const uint8_t port, const bool b_enable) {
if (1200 == dwDTERate) {
// We check DTR state to determine if host port is open (bit 0 of lineState).
if (!b_enable)
if (!b_enable) {
// Set RST pin to go low for 65535 clock cycles on reset
// This helps restarting when firmware flash ends
RSTC->RSTC_MR = 0xA5000F01;
// Schedule delayed reset
initiateReset(250);
}
else
cancelReset();
}
@@ -290,7 +297,7 @@ bool usb_task_other_requests(void) {
return true;
}
void HAL_init(void) {
void usb_task_init(void) {
uint16_t *ptr;