FIX 1.解决emmc异常导致设备无法正常重启问题,解决方法:软件不喂狗,使硬件看门狗重启设备。2.增加软件不喂狗测试:"watchdog test on" 指令

main
wangbo 1 year ago
parent 262a2061be
commit 0689e2e069

@ -119,9 +119,9 @@
#define CMD_IPV6(S) (0 == strcmp((S), "X:X::X:X"))
#define CMD_IPV6_PREFIX(S) (0 == strcmp((S), "X:X::X:X/M"))
#define DEV_INFO_DEFAULT_IP "192.168.1.185"
#define DEV_INFO_DEFAULT_IP "192.168.10.185"
#define DEV_INFO_DEFAULT_MASK "255.255.255.0"
#define DEV_INFO_DEFAULT_GW "192.168.1.1"
#define DEV_INFO_DEFAULT_GW "192.168.10.1"
#define DEVICE_RUN_PATH "/home/Cable"
#define DEVICE_BAK_PATH "/home/root"

@ -179,6 +179,7 @@ extern int32_t time_str_to_long(char *date, char *time, uint32_t *t);
extern uint16_t version_str_to_int(void);
extern void time_set(time_t timestamp);
extern void reboot_system(int module, BOOT_MSG type);
extern void watch_dog_set(int val);
extern void set_nonblock(int sock);
int StrToHex(unsigned char *hex, char *str, int slen);
unsigned int dev_id_2_hex(char *dev_num);

@ -245,7 +245,7 @@ int _dbg_pkt_realdata_get(debug_msg_info_t *msg)
//rtd->StartFlag1 = sysVar.gateway;
rtd->RunSecCnt = now - sysctrl.start_time;
//rtd->Local_Vbat = realpack.vbat;
//rtd->RoomIn_Temp = temp2U16(envVal[0]);
rtd->RoomIn_Temp = 0x0C02;//temp2U16(envVal[0]);
rtd->RMS_Ia = cauValues[0];
rtd->RMS_Ib = cauValues[1];
rtd->RMS_Ic = cauValues[2];
@ -254,7 +254,7 @@ int _dbg_pkt_realdata_get(debug_msg_info_t *msg)
rtd->RMS_rIa = cauValues[5];
rtd->RMS_rIb = cauValues[6];
rtd->RMS_rIc = cauValues[7];
//rtd->RoomOut_Temp = temp2U16(envVal[0]);
rtd->RoomOut_Temp = 0x0C02;//temp2U16(envVal[0]);
//rtd->I16A_Gx = (U16)(tsTag[0]+16000);
//rtd->I16A_Gy = (U16)(tsTag[1]+16000);
//rtd->I16A_Gz = (U16)(tsTag[2]+16000);

@ -73,6 +73,7 @@
int32_t recv_qid;
uint16_t version_hex;
sys_ctrl_t sysctrl = {0};
int is_system_reboot = FALSE;
/* Private function prototypes -----------------------------------------------*/
@ -110,6 +111,17 @@ int32_t process_init(void)
return E_NONE;
}
void wdg_clr()
{
static unsigned int cnt = 0;
/*防止设备重启不成功,
cpu */
if (is_system_reboot)
return;
GPIO_WDT_CTRL((cnt++) & 0x1);
}
/* description: 程序入口函数.
param:
return: */
@ -192,9 +204,10 @@ int32_t main(int32_t argc, char **argv)
if(wdt_Cnt++ > 10)
{
wdt_Cnt = 0;
GPIO_WDT_CTRL(1);
usleep(100*1000);
GPIO_WDT_CTRL(0);
//GPIO_WDT_CTRL(1);
//usleep(100*1000);
//GPIO_WDT_CTRL(0);
wdg_clr();
}
time_t curTime = time(NULL);

@ -601,6 +601,24 @@ CMD(enable_test,
return CMD_SUCCESS;
}
CMD(watchdog_test,
watchdog_test_cmd,
"watchdog test (on|off)",
"watchdog test mode\n")
{
if (strncmp(argv[0], "on", strlen(argv[0])) == 0)
{
watch_dog_set(0x55);
}
else
{
watch_dog_set(0x0);
}
return CMD_SUCCESS;
}
/* Private function prototypes -----------------------------------------------*/
/* Internal functions --------------------------------------------------------*/
@ -2390,6 +2408,7 @@ void cmd_init(void)
cmd_install_element(ENABLE_NODE, &logoff_cmd);
cmd_install_element(ENABLE_NODE, &enable_test_cmd);
cmd_install_element(ENABLE_NODE, &reboot_cmd);
cmd_install_element(ENABLE_NODE, &watchdog_test_cmd);
cmd_install_element(CONFIG_NODE, &hostname_set_cmd);
cmd_install_element(CONFIG_NODE, &config_log_level_cmd);

@ -613,10 +613,19 @@ boot_msg_t g_bootmsg[] =
{BOOT_MAX, NULL}
};
extern int is_system_reboot;
int watch_dog_test_flag = 0;
void reboot_system(int module, BOOT_MSG type)
{
BOOT_MSG i;
char *pmsg = NULL;
is_system_reboot = TRUE;
if (watch_dog_test_flag)
{
LOG("Watch dog test mode, system not reboot...");
return;
}
for (i = BOOT_NONE; i < BOOT_MAX; i++)
{
if (g_bootmsg[i].type == type)
@ -635,6 +644,16 @@ void reboot_system(int module, BOOT_MSG type)
}
}
void watch_dog_set(int val)
{
if (val == 0)
{
is_system_reboot = FALSE;
}
watch_dog_test_flag = val;
printh("watch_dog_test_flag = 0x%x is_system_reboot = %d\r\n", watch_dog_test_flag, is_system_reboot);
}
void set_nonblock(int sock)
{

@ -31,7 +31,7 @@ VERSION_FILE := $(SOURCE_DIR)/include/version.h
MQTTLIB_DIR := $(SOURCE_DIR)/lib/l_library
VERSION_LIB := version.a
DATE_STRING := `date "+%Y.%m.%d %k:%M:%S"`
VERSION_STRING := "6.2.1.16"
VERSION_STRING := "6.2.1.17"
MV := mv -f
RM := rm -rf
@ -111,7 +111,7 @@ $(VERSION_LIB): $(CONFIG_FILE) $(libraries) version.c
Cable: $(CONFIG_FILE) $(libraries) $(VERSION_LIB)
# 使用两次$(libraries)避免库文件之间的交叉引用问题.
$(QUIET)$(LINK.o) -rdynamic $(libraries) $(VERSION_LIB) $(LDLIB) -L $(LIBPATH) -o $@
$(QUIET)$(LINK.o) -rdynamic $(libraries) $(libraries) $(VERSION_LIB) $(LDLIB) -L $(LIBPATH) -o $@
@echo "$(INFO_C)LINK $@ done";echo
# $(QUIET)cp $@ //home//embed//LandPower//

Loading…
Cancel
Save