Sadly removed the watchdog

Due to some issues with wake-up and reset case
This commit is contained in:
2025-10-14 22:28:54 +02:00
parent 33108f63f6
commit d85316aa3c
4 changed files with 2 additions and 62 deletions
-11
View File
@@ -132,17 +132,6 @@ extern "C" {
#define KBD_BCKL_STEPS 4
#ifdef __HAL_WWDG_ENABLE
#undef __HAL_WWDG_ENABLE
#endif
#define __HAL_WWDG_ENABLE() __HAL_RCC_WWDG_CLK_ENABLE()
#ifdef __HAL_WWDG_DISABLE
#undef __HAL_WWDG_DISABLE
#endif
#define __HAL_WWDG_DISABLE() __HAL_RCC_WWDG_CLK_DISABLE()
// Structure definition ---------------------------------------------------------------
typedef union {
uint32_t raw;
+2 -36
View File
@@ -366,23 +366,6 @@ static void MX_USART3_UART_Init(void) {
#endif
}
/**
* @brief WWDG Initialization Function
* @param None
* @retval None
*/
static void MX_WWDG_Init(void) {
hwwdg.Instance = WWDG;
hwwdg.Init.Prescaler = WWDG_PRESCALER_2;
hwwdg.Init.Window = 127;
hwwdg.Init.Counter = 127;
hwwdg.Init.EWIMode = WWDG_EWI_DISABLE;
if (HAL_WWDG_Init(&hwwdg) != HAL_OK)
Error_Handler();
// Not using it for now
__HAL_WWDG_DISABLE();
}
/**
* @brief GPIO Initialization Function
* @param None
@@ -817,17 +800,6 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) {
#endif
}
/**
* @brief WWDG MSP Initialization
* This function configures the hardware resources used in this example
* @param hwwdg: WWDG handle pointer
* @retval None
*/
void HAL_WWDG_MspInit(WWDG_HandleTypeDef* hwwdg) {
if(hwwdg->Instance==WWDG)
__HAL_RCC_WWDG_CLK_ENABLE();
}
/**
* @brief This function is executed in case of error occurrence.
@@ -836,16 +808,13 @@ void HAL_WWDG_MspInit(WWDG_HandleTypeDef* hwwdg) {
void Error_Handler(void) {
// When the southbridge is in hardfault condition,
// make the front led blink.
// The watchdog is disabled to avoid pico reset.
//TODO: to be tested...
#ifndef DEBUG
__HAL_WWDG_DISABLE();
#endif
// TODO: Wait sometime before use NVIC_SystemReset()
__disable_irq();
while (1) {
LL_GPIO_TogglePin(SYS_LED_GPIO_Port, SYS_LED_Pin);
HAL_Delay(300);
}
NVIC_SystemReset();
}
#ifdef USE_FULL_ASSERT
@@ -937,9 +906,6 @@ HAL_StatusTypeDef HAL_Interface_init(void) {
MX_RTC_Init();
MX_USART1_UART_Init();
MX_USART3_UART_Init();
#ifndef DEBUG
MX_WWDG_Init();
#endif
MX_TIM1_Init();
MX_TIM3_Init();
MX_TIM2_Init();
-14
View File
@@ -270,14 +270,7 @@ int main(void) {
#endif
lcd_backlight_on();
#ifndef DEBUG
__HAL_WWDG_ENABLE();
#endif
while (1) {
#ifndef DEBUG
HAL_WWDG_Refresh(&hwwdg);
#endif
// Re-arm I2CS in case of lost master signal
if (i2cs_state != I2CS_STATE_IDLE && ((uptime_ms() - i2cs_rearm_counter) > I2CS_REARM_TIMEOUT))
i2cs_state = I2CS_STATE_IDLE;
@@ -311,9 +304,6 @@ int main(void) {
sys_prepare_sleep();
// Low-power mode entry
#ifndef DEBUG
__HAL_WWDG_DISABLE();
#endif
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
SystemClock_Config();
@@ -321,10 +311,6 @@ int main(void) {
HAL_Delay(300);
// Wake-up peripherals from low-power mode
#ifndef DEBUG
HAL_WWDG_Refresh(&hwwdg);
__HAL_WWDG_ENABLE();
#endif
sys_wake_sleep();
force_rtc_bck_load();
force_rtc_bck_sync();
-1
View File
@@ -71,7 +71,6 @@ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_wwdg.c \
Core/Src/system_stm32f1xx.c
# ASM sources