Hello,
NCS2.0.2, nRF5340, VScode, watchdog
i want to uninstall watch dog before sys_reboot(0) for DFU;
but as follow no use. it will Restart twice.
Hello,
NCS2.0.2, nRF5340, VScode, watchdog
i want to uninstall watch dog before sys_reboot(0) for DFU;
but as follow no use. it will Restart twice.
Hi Yo,
I took the SMP Server Sample and added a Watchdog to it.
Then I tested to do DFU over Bluetooth using the nRF Connect for Mobile app.
This seems to work fine for me.
Do you get the same issue if you try this?
Regards,
Sigurd Hellesvik
Hi,
thanks for reply,
your zip project no problem. it running DFU mode anytime.
but my means not that, see pic
static bool will_ota=false,grunning=true; //---------------------------------------------------------------------------------------- static const struct gpio_dt_spec button0 = GPIO_DT_SPEC_GET_OR(DT_ALIAS(sw0), gpios,{0}); static struct gpio_callback button_cb_data1; void button_pressed0(const struct device *dev, struct gpio_callback *cb,uint32_t pins) { gpio_remove_callback(button0.port, &button_cb_data1); printk("button_pressed0\n"); grunning=false; will_ota=true; } void init_button_led(void) { if (!device_is_ready(button0.port)) { printk("Error: button device %s is not ready\n",button0.port->name); return; } int ret = gpio_pin_configure_dt(&button0, GPIO_INPUT); if (ret != 0) { printk("Error %d: failed to configure %s pin %d\n",ret, button0.port->name, button0.pin); return; } ret = gpio_pin_interrupt_configure_dt(&button0,GPIO_INT_EDGE_TO_ACTIVE); if (ret != 0) { printk("Error %d: failed to configure interrupt on %s pin %d\n", ret, button0.port->name, button0.pin); return; } gpio_init_callback(&button_cb_data1, button_pressed0, BIT(button0.pin)); gpio_add_callback(button0.port, &button_cb_data1); } //---------------------------------------------------------------------------------------- void ota(void) { os_mgmt_register_group(); img_mgmt_register_group(); smp_bt_register(); int err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); return; } if (IS_ENABLED(CONFIG_SETTINGS)) { settings_load(); } err = bt_le_adv_start(BT_LE_ADV_CONN, upad, ARRAY_SIZE(upad),upsd, ARRAY_SIZE(upsd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; } printk(" OTA Advertising started: %s\n",bt_get_name()); // if wait no OTA start, timeout 3min will reboot for (int i=0;i<180;i++) { k_sleep(K_MSEC(1000)); } printk("\n---------------OTA timeout---------------\n\n"); sys_reboot(0); } void main(void) { printk("Hello World!\n" ); mcu_flash_init(); if(mcu_flash_need_ota()) { mcu_flash_write_ota(0);//clear ota tag ota(); return; }else printk("Starting Advertising\n"); init_button_led(); // ... bt_le_per_adv_start(...);// doing another type bluetooth init_dog(); while(grunning){ // ..... k_msleep(1000); feed_dog(); } //-------------------------------------- bt_le_per_adv_stop(...); uninit_dog(); if(will_ota) sys_reboot(0); else go_system_off(); }
dog set to 3s.
Normal situation, app not start DFU, doing another type bluetooth,
when button down will mak to flash and reboot device,
when app start, first check mak,
if got mak will start DFU and not do other anything.
becuse unintidog -1,sys_reboot(0) will case reboot twice.
why dog uninit failed?
so i only must wait long time for dog reboot.
Best regards
Hi,
I do not think I understand your issue.
Could you zip your project and send, so I can test?
Regards,
Sigurd Hellesvik
Hi, Sigurd Hellesvik
thanks for reply,
this zip for nRF5340-DK, NCS2.0.2,
button1 to DFU, it will reboot twice.
Best regards
Hi,
Due to constraints in our WDT Peripheral, the watchdog can not be stopped on nRF Devices. Therefore wdt_disable() will not work.
Here are alternatives you have:
Regards,
Sigurd Hellesvik