Set watchdog to approximately 2s and add refreshing

This commit is contained in:
BlackMark 2020-07-09 19:58:20 +02:00
parent 8e15ee72f3
commit 5169ddd4bd
3 changed files with 4 additions and 2 deletions

View File

@ -90,7 +90,6 @@ void init(void)
MX_GPIO_Init(); MX_GPIO_Init();
MX_ADC_Init(); MX_ADC_Init();
MX_USB_DEVICE_Init(); MX_USB_DEVICE_Init();
MX_IWDG_Init();
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
/* USER CODE END 2 */ /* USER CODE END 2 */

View File

@ -31,7 +31,7 @@ void MX_IWDG_Init(void)
{ {
hiwdg.Instance = IWDG; hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_4; hiwdg.Init.Prescaler = IWDG_PRESCALER_16;
hiwdg.Init.Window = 4095; hiwdg.Init.Window = 4095;
hiwdg.Init.Reload = 4095; hiwdg.Init.Reload = 4095;
if (HAL_IWDG_Init(&hiwdg) != HAL_OK) if (HAL_IWDG_Init(&hiwdg) != HAL_OK)

View File

@ -1,4 +1,5 @@
#include "init.h" #include "init.h"
#include "iwdg.h"
#include "terminal.hpp" #include "terminal.hpp"
#include "uart.hpp" #include "uart.hpp"
@ -37,11 +38,13 @@ static inline void initializeHardware()
int main() int main()
{ {
initializeHardware(); initializeHardware();
MX_IWDG_Init();
terminal_t terminal; terminal_t terminal;
while(true) { while(true) {
terminal.callback(); terminal.callback();
HAL_IWDG_Refresh(&hiwdg);
} }
return 0; return 0;