Implement unresponsive tinySA reboot using WDG

pull/94/head
Bohdan Kmit 2 years ago
parent 31a89ceda8
commit a4602cb729

@ -223,6 +223,6 @@
/*
* WDG driver system settings.
*/
#define STM32_WDG_USE_IWDG FALSE
#define STM32_WDG_USE_IWDG TRUE
#endif /* MCUCONF_H */

@ -92,7 +92,7 @@
#else
// Use 32768Hz LSE
#define STM32_LSE_ENABLED TRUE
#define STM32_LSI_ENABLED FALSE
#define STM32_LSI_ENABLED TRUE
#define STM32_RTCSEL STM32_RTCSEL_LSE
#define STM32_RTC_PRESA_VALUE 32
#define STM32_RTC_PRESS_VALUE 1024
@ -265,6 +265,6 @@
/*
* WDG driver system settings.
*/
#define STM32_WDG_USE_IWDG FALSE
#define STM32_WDG_USE_IWDG TRUE
#endif /* MCUCONF_H */

@ -175,7 +175,7 @@
* @brief Enables the WDG subsystem.
*/
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
#define HAL_USE_WDG FALSE
#define HAL_USE_WDG TRUE
#endif
/*===========================================================================*/

@ -285,6 +285,7 @@ static THD_FUNCTION(Thread1, arg)
// plot trace and other indications as raster
draw_all(completed); // flush markmap only if scan completed to prevent
// remaining traces
wdgReset(&WDGD1);
// STOP_PROFILE
}
@ -3102,6 +3103,13 @@ int main(void)
set_sweep_frequency(ST_STOP, (freq_t) 4000000);
sweep(false);
#endif
static const WDGConfig scan_wdgcfg = {
STM32_IWDG_PR_256,
STM32_IWDG_RL(1 * (40000 / 256)), /* 1 second */
STM32_IWDG_WIN_DISABLED
};
wdgInit();
wdgStart(&WDGD1, &scan_wdgcfg);
if (reset_state|| (caldata_recall(0) == -1)) {
load_LCD_properties();

@ -4932,6 +4932,7 @@ again: // Spur redu
t++; // one subscan done
if (break_on_operation && operation_requested) // break subscanning if requested
break; // abort
wdgReset(&WDGD1);
} while (t < local_vbw_steps); // till all sub steps done
TRACE(7);
#ifdef TINYSA4

@ -186,6 +186,7 @@ int btn_side(void)
static int btn_check(void)
{
systime_t ticks;
wdgReset(&WDGD1);
// Debounce input
while(TRUE){
ticks = chVTGetSystemTimeX();
@ -212,6 +213,7 @@ static int btn_check(void)
static int btn_wait_release(void)
{
while (TRUE) {
wdgReset(&WDGD1);
systime_t ticks = chVTGetSystemTimeX();
systime_t dt = ticks - last_button_down_ticks;
// Debounce input
@ -299,6 +301,7 @@ touch_measure_x(void)
static inline int
touch_status(void)
{
wdgReset(&WDGD1);
return adc_single_read(ADC_TOUCH_Y) > TOUCH_THRESHOLD;
}
@ -655,6 +658,8 @@ extern const char *states[];
chThdSleepMilliseconds(40);
if ((cnt++)&0x07) continue; // Not update time so fast
wdgReset(&WDGD1);
#ifdef TINYSA4
#ifdef __USE_RTC__
uint32_t tr = rtc_get_tr_bin(); // TR read first
@ -7798,6 +7803,7 @@ static void sa_save_file(uint8_t format) {
#else
plot_printf(fs_filename, FF_LFN_BUF, "%08x.%s", rtc_get_FAT(), file_ext[format]);
#endif
wdgReset(&WDGD1);
}
else {
ui_mode_keypad(KM_FILENAME);

Loading…
Cancel
Save

Powered by TurnKey Linux.