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

@ -642,5 +642,6 @@ U16 stream_stop(U8 id)
//! @}
#endif // ACCESS_STREAM == true
#endif
#endif // ACCESS_STREAM
#endif // ARDUINO_ARCH_SAM

View File

@ -119,4 +119,4 @@ void sysclk_disable_usb(void)
/**INDENT-ON**/
/// @endcond
#endif
#endif // ARDUINO_ARCH_SAM

View File

@ -1146,4 +1146,4 @@ bool udc_process_setup(void)
//! @}
#endif
#endif // ARDUINO_ARCH_SAM

View File

@ -1152,4 +1152,4 @@ iram_size_t udi_cdc_write_buf(const void* buf, iram_size_t size)
//@}
#endif
#endif // ARDUINO_ARCH_SAM

View File

@ -255,5 +255,7 @@ UDC_DESC_STORAGE udc_config_t udc_config = {
//@}
//@}
#endif
#endif
#endif // SDSUPPORT
#endif // ARDUINO_ARCH_SAM

View File

@ -187,5 +187,6 @@ UDC_DESC_STORAGE udc_config_t udc_config = {
/**INDENT-ON**/
//@}
#endif
#endif
#endif // ARDUINO_ARCH_SAM
#endif // SDSUPPORT

View File

@ -1127,5 +1127,6 @@ bool udi_msc_trans_block(bool b_read, uint8_t * block, iram_size_t block_size,
//@}
#endif
#endif
#endif // SDSUPPORT
#endif // ARDUINO_ARCH_SAM

View File

@ -2070,4 +2070,4 @@ static bool udd_ep_interrupt(void)
//@}
#endif
#endif // ARDUINO_ARCH_SAM

View File

@ -238,5 +238,4 @@ void otg_dual_disable(void);
}
#endif
#endif /* UOTGHS_OTG_H_INCLUDED */

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;

View File

@ -49,6 +49,10 @@
#include "usb_protocol_cdc.h"
#ifdef __cplusplus
extern "C" {
#endif
/*! \brief Called by MSC interface
* Callback running when USB Host enable MSC interface
*
@ -111,8 +115,20 @@ void usb_task_cdc_rx_notify(const uint8_t port);
*/
void usb_task_cdc_config(const uint8_t port, usb_cdc_line_coding_t *cfg);
/* The USB device interrupt
/*! \brief The USB device interrupt
*/
void USBD_ISR(void);
#endif // _MAIN_H_
/*! \brief USB task init
*/
void usb_task_init(void);
/*! \brief USB task idle
*/
void usb_task_idle(void);
#ifdef __cplusplus
}
#endif
#endif // _USB_TASK_H_