加了个独立看门狗
This commit is contained in:
parent
cdb8c62267
commit
caa17f68ed
|
@ -2,7 +2,7 @@
|
||||||
* @Author: mbw
|
* @Author: mbw
|
||||||
* @Date: 2024-12-03 11:13:13
|
* @Date: 2024-12-03 11:13:13
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
* @LastEditTime: 2024-12-15 17:16:45
|
* @LastEditTime: 2025-04-13 22:40:51
|
||||||
* @FilePath: \ble_-tyq_-bjq_-ch584-m\APP\multiCentral_main.c
|
* @FilePath: \ble_-tyq_-bjq_-ch584-m\APP\multiCentral_main.c
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
|
@ -104,7 +104,7 @@ int main(void)
|
||||||
BSP_FLASH_Init();
|
BSP_FLASH_Init();
|
||||||
BSP_Valve_Init();
|
BSP_Valve_Init();
|
||||||
BSP_UART1_Init(); // BT UART
|
BSP_UART1_Init(); // BT UART
|
||||||
// IWDG_Init(1000);
|
IWDG_Init(1000);
|
||||||
Main_Circulation();
|
Main_Circulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @Author : stark1898y 1658608470@qq.com
|
* @Author : stark1898y 1658608470@qq.com
|
||||||
* @Date : 2024-12-15 16:13:41
|
* @Date : 2024-12-15 16:13:41
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
* @LastEditTime: 2024-12-16 10:50:56
|
* @LastEditTime: 2025-04-13 22:42:49
|
||||||
* @FilePath: \ble_-tyq_-bjq_-ch584-m\bsp\src\bsp_iwdg.c
|
* @FilePath: \ble_-tyq_-bjq_-ch584-m\bsp\src\bsp_iwdg.c
|
||||||
* @Description :
|
* @Description :
|
||||||
*
|
*
|
||||||
|
@ -31,7 +31,7 @@ uint16_t IWDG_ProcessEvent(uint8_t task_id, uint16_t events)
|
||||||
if (events & IWIG_FEED_EVENT)
|
if (events & IWIG_FEED_EVENT)
|
||||||
{
|
{
|
||||||
FEED_IWDG();
|
FEED_IWDG();
|
||||||
tmos_start_task(task_id, IWIG_FEED_EVENT, 10000);
|
tmos_start_task(task_id, IWIG_FEED_EVENT, 2000);
|
||||||
return (events ^ IWIG_FEED_EVENT);
|
return (events ^ IWIG_FEED_EVENT);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -62,9 +62,8 @@ void IWDG_Init(uint16_t ms)
|
||||||
R32_IWDG_KR = 0x5555; // 解除IWDG保护
|
R32_IWDG_KR = 0x5555; // 解除IWDG保护
|
||||||
R32_IWDG_CFG |= (7 << 12); // 32K分频512,时钟62.5Hz
|
R32_IWDG_CFG |= (7 << 12); // 32K分频512,时钟62.5Hz
|
||||||
R32_IWDG_CFG &= 0xFFFFF000;
|
R32_IWDG_CFG &= 0xFFFFF000;
|
||||||
R32_IWDG_CFG |= 0x10; // 看门狗时间约256ms(0x10/(32K/512))
|
R32_IWDG_CFG |= 0x7D; // 看门狗时间约256ms(0x10/(32K/512))
|
||||||
R32_IWDG_KR = 0xCCCC;
|
R32_IWDG_KR = 0xCCCC;
|
||||||
PRINT("R32_IWDG_CFG = %x\r\n", R32_IWDG_CFG);
|
|
||||||
|
|
||||||
IWDGTaskId = TMOS_ProcessEventRegister(IWDG_ProcessEvent);
|
IWDGTaskId = TMOS_ProcessEventRegister(IWDG_ProcessEvent);
|
||||||
tmos_set_event(IWDGTaskId, IWIG_FEED_EVENT);
|
tmos_set_event(IWDGTaskId, IWIG_FEED_EVENT);
|
||||||
|
|
|
@ -316,6 +316,8 @@ uint16_t BSP_Send_Process(uint8_t *pdata)
|
||||||
logError("不支持的命令: %d", master_rx_buf[1]);
|
logError("不支持的命令: %d", master_rx_buf[1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t BT_ProcessEvent(uint8_t task_id, uint16_t events)
|
uint16_t BT_ProcessEvent(uint8_t task_id, uint16_t events)
|
||||||
|
@ -556,6 +558,8 @@ void BSP_Uart3_Send_Loop(void)
|
||||||
int reboot(void)
|
int reboot(void)
|
||||||
{
|
{
|
||||||
PFIC_SystemReset();
|
PFIC_SystemReset();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC),
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC),
|
||||||
reboot, reboot, "reboot");
|
reboot, reboot, "reboot");
|
||||||
|
|
Loading…
Reference in New Issue