在調(diào)試CH573看門狗的代碼中,本人在接收到串口指令后,啟用開門狗我添加了以下兩條代碼:

WWDG_SetCounter(0x0);

WWDG_ResetCfg(ENABLE);

程序沒有其它地方進(jìn)行喂狗操作。但有時看門狗復(fù)位,有時不復(fù)位,請問是怎么回事?


代碼片段如下:

void uart1_msgProcess(uint8_t* msg_ptr)

{

? uint8_t msg_len = msg_ptr[0];

? uint8_t *pMsg = msg_ptr+1;

? static bool cmd_test = false;


? if(strncmp((char *)pMsg,"#software_reset\r\n",strlen("#software_reset\r\n")) == 0){

? ? PRINT("software reset\n");

? ? sys_softReset();

? }

? else if(strncmp((char *)pMsg,"#test_wdog\r\n",strlen("#test_wdog\r\n")) == 0){

? ? PRINT("Test watch_dog\n");

? ? WWDG_SetCounter(0x0);

? ? WWDG_ResetCfg(ENABLE);

? }


調(diào)試信息如下: 啟動了3次看門狗,前兩次成功復(fù)位,第三次沒起作用

Test watch_dog

1s count 553, systick:553030

uart1_init

VER_LIB: CH57x_BLE_LIB_V1.50

readChipId:0x01 0x36 0x39 0x34 0x41 0x30 0x50 0x42

UniqueID:0136393441305042

uartTask init

Initialized..

Advertising..

1s count 1, systick:991

1s count 2, systick:1991

1s count 3, systick:2991

1s count 4, systick:3991

RX 12B: #test_wdog


Test watch_dog

uart1_init

VER_LIB: CH57x_BLE_LIB_V1.50

readChipId:0x01 0x36 0x39 0x34 0x41 0x30 0x50 0x42

UniqueID:0136393441305042

uartTask init

Initialized..

Advertising..

1s count 1, systick:991

1s count 2, systick:1991

1s count 3, systick:2991

1s count 4, systick:3991

RX 12B: #test_wdog


Test watch_dog

1s count 5, systick:4991

1s count 6, systick:5991

1s count 7, systick:6991

1s count 8, systick:7991

1s count 9, systick:8991

1s count 10, systick:9991