Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Robust datalogging – auto-reset upon hanging #13645
    antapc
    Participant

    Hi Phang Moh,

    I think the gist of it was the system needs to wakeup from __WFI() before SysTick starts firing off events due to a WDT issue, hence the need to disable it prior to going to sleep and then enabling once the system and things like RAM are ready. I forgot to mention in my post that post #18 in that Atmel forum link explains what’s going on. This of course could be totally unrelated to Thomas’s issue but I just thought I’d mention it in case it might help.

    On a side note too: Debugging sleep code via a connected USB seems to cause hangs once you hit about the 40 cycle mark…at least in my setup anyway. No issues at all when USB is disconnected…apart from the odd very rare random lockup during sleep – which might be sorted…?

    in reply to: Robust datalogging – auto-reset upon hanging #13616
    antapc
    Participant

    Hi Thomas,

    I was also having random lockups during sleep and came across this post:
    https://community.atmel.com/forum/samd21-samd21e16b-sporadically-locks-and-does-not-wake-standby-sleep-mode

    I’ve updated my standbyMode within RTCZero.cpp to the following:

    void RTCZero::standbyMode()
    {
      // Entering standby mode when connected
      // via the native USB port causes issues.
    
      SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk; // disable SysTick interrupt before going to sleep ***atmel fix for lockups while asleep
                                                  // see https://community.atmel.com/forum/samd21-samd21e16b-sporadically-locks-and-does-not-wake-standby-sleep-mode
    
      SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
    
      __DSB();
    
      __WFI();
    
      SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk; // enable SysTick interrupt when exiting sleep ***atmel fix for lockups while asleep
    }

    I haven’t tested this for a particularly long time but it seems to be running ok for the past few days.
    I also haven’t put in a pull request yet…we’ll wait and see how it goes!

Viewing 2 posts - 1 through 2 (of 2 total)