System.updatesPending() freezes and hardware watchdog gets triggered

Hello everybody,

I have some units that are showing some weird behaviour that I cannot wrap my head around.

I have a function that handles updates as follows:

void CloudClass::handleUpdates()
   // Connect, if not connected
   Class::instance().systemCheckin(); // Watchdog

   if (System.updatesPending())
      unsigned long start = System.millis();

      while ((System.millis() - start) < DeviceConfigurationConstants::CONNECTION_TIMEOUT)
         Class::instance().systemCheckin(); // Watchdog
      // Device normally won't reach this point as it will restart automatically to apply the update.

It 'simply' checks if there's any updates pending, if so, enables updates. Problem is that the watchdog gets triggered before the if (System.updatesPending()) line, but the watchdog has a timeout of 5-10 minutes and gets a checkin just before the function is called.

So my question is how the updatesPending works and in what cases can it 'freeze' the execution of the program? Or could it simply be a hardware issue somehow? It's just weird that It stops at the part of the program on each startup, because the units will essentially go into a 'forever' hardware watchdog restart loop.

It's probably not System.updatesPending() directly. That just reads a global variable within Device OS. It doesn't appear to access the cloud at all, require a swap to the system thread, or obtain any mutex.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.