Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By picstart
#10371
Code: Select all    void user_init(void)
    {
       uint32 delay=200000;
       // Configure the UART
       uart_init(BIT_RATE_115200, BIT_RATE_115200);
    //   ets_wdt_init(100000);
       ets_wdt_enable();
    //   ets_wdt_disable();
       wdt_feed();
       ets_uart_printf("START\r\n");
       wdt_feed();
    //   for(;;)   //gets wdt_reset after very short time.
            for(;;)     // no wdt resets at all
       {
          ets_delay_us(delay);
          delay+=200000;
          wdt_feed();
          ets_uart_printf("%d\r\n",delay);
          wdt_feed();
       }


In the above the comments are not helping but anyway the code below is the code that has a chance of working
since it feeds the wdt inside the loop that is consuming time however since the time between wdt feeds is increasing
at some point the delay will be sufficient to trigger a wdt reset.
Code: Select all         for(;;)     // no wdt resets at all
       {
          ets_delay_us(delay);
          delay+=200000;
          wdt_feed();
          ets_uart_printf("%d\r\n",delay);
          wdt_feed();
       }

Question
Your commented code says [quote// no wdt resets at all][/quote] so it is true or not true that there were no wdt resets?
If it is somewhat true ( small delays didn't trigger a reset) how large did the delay have to be to trigger a wdt reset ( expectation is around 1 elapsed second )?
Or are you saying in spite of the code comments that resets occur whether the wdt is fed or not ( feeding is broken)?
User avatar
By rew
#18495 I have a very similar problem.

I DO NOT want the watchdog to reset the chip. (I've enabled a few external things, for debugging, and they tend to go "off" again when I (deep)sleep the CPU). So where the CPU normally goes to sleep I now have:
Code: Select allif (debugging_requested ()) {
   // enable the external things
   ...
   os_printf ("sleeping (with einkon) for 10 mins\n");
   for (i=0;i<600*2;i++) {
      os_delay_us (500*1000);
      wdt_feed ();
   }
   os_printf ("sleep is over. See what happens if we just return");
} else {
   system_deep_sleep(sleeptime*1000*1000);
}
but each time it enters this loop, it soon restarts the CPU with a watchdog reset.

Any suggestions?