feat(vd960Loop): 看门狗升级双保险喂狗模式 + 超时对齐 V4B(1.64s)

对照 DLD154V4B V2.10(同款 AT32F421):
- 原直喂模式缺 ISR 活性检测: TMR15 ISR 死但主循环活 -> 看门狗永不复位(假活)
- 升级: TMR15 ISR 5ms 递增 g_wdg_counter + 主循环 poll_wdg() 500ms 才 reload
- 超时 3s(div64/rld1875) -> 1.64s(div16枚举/rld4095)
- wdt_feed 定义移至 TaskLoop.c 改名 poll_wdg, 与 V4B 同构
- 修正 main.c 注释矛盾(4687 vs 1875); 沿用 WDT_CLK_DIV_16 枚举写法避免
  V4B 同源传值 bug
- 隔离测试 3 项断言全过(分频16/超时1638ms>500ms/10s喂20次/ISR死不喂)
This commit is contained in:
wangfq
2026-08-28 09:15:25 +08:00
parent 40e6648445
commit fd1e1ee167
60 changed files with 21386 additions and 20 deletions
@@ -0,0 +1,150 @@
/**
**************************************************************************
* @file at32f421_board.h
* @brief header file for at-start board. set of firmware functions to
* manage leds and push-button. initialize delay function.
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
#ifndef __AT32F421_BOARD_H
#define __AT32F421_BOARD_H
#ifdef __cplusplus
extern "C" {
#endif
#include "stdio.h"
#include "at32f421.h"
/** @addtogroup AT32F421_board
* @{
*/
/** @addtogroup BOARD
* @{
*/
/** @defgroup BOARD_pins_definition
* @{
*/
/**
* this header include define support list:
* 1. at-start-f421 v1.x boards
* if define AT_START_F421_V1, the header file support at-start-f421 v1.x board
*/
#if !defined (AT_START_F421_V1)
#error "please select first the board at-start device used in your application (in at32f421_board.h file)"
#endif
/******************** define led ********************/
typedef enum
{
LED2 = 0,
LED3 = 1,
LED4 = 2
} led_type;
#define LED_NUM 3
#if defined (AT_START_F421_V1)
#define LED2_PIN GPIO_PINS_5
#define LED2_GPIO GPIOA
#define LED2_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
#define LED3_PIN GPIO_PINS_4
#define LED3_GPIO GPIOA
#define LED3_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
#define LED4_PIN GPIO_PINS_8
#define LED4_GPIO GPIOA
#define LED4_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
#endif
/**************** define print uart ******************/
#define PRINT_UART USART1
#define PRINT_UART_CRM_CLK CRM_USART1_PERIPH_CLOCK
#define PRINT_UART_TX_PIN GPIO_PINS_9
#define PRINT_UART_TX_GPIO GPIOA
#define PRINT_UART_TX_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
#define PRINT_UART_TX_PIN_SOURCE GPIO_PINS_SOURCE9
#define PRINT_UART_TX_PIN_MUX_NUM GPIO_MUX_1
/******************* define button *******************/
typedef enum
{
USER_BUTTON = 0,
NO_BUTTON = 1
} button_type;
#define USER_BUTTON_PIN GPIO_PINS_0
#define USER_BUTTON_PORT GPIOA
#define USER_BUTTON_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
/**
* @}
*/
/** @defgroup BOARD_exported_functions
* @{
*/
/******************** functions ********************/
void at32_board_init(void);
/* led operation function */
void at32_led_init(led_type led);
void at32_led_on(led_type led);
void at32_led_off(led_type led);
void at32_led_toggle(led_type led);
/* button operation function */
void at32_button_init(void);
button_type at32_button_press(void);
uint8_t at32_button_state(void);
/* delay function */
void delay_init(void);
void delay_us(uint32_t nus);
void delay_ms(uint16_t nms);
void delay_sec(uint16_t sec);
/* printf uart init function */
void uart_print_init(uint32_t baudrate);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif