Why is my software calling a function after HIBERNATE sleep?

I have a BQ32000 RTC connected with D8 of a Particle Argon (Firmware 1.5.2). The RTC generates a 1 Hz squarewave to wake the Argon periodically from hibernate sleep, but it seems that the software of the Argon will reset each time because of the output of the function StartUpMessage is printed every time.

#include "BQ32000/BQ32000.h"

#define BQ32000_IRQ                         D8

SystemSleepConfiguration SleepConfig;
BQ32000 RTC;

SYSTEM_MODE(MANUAL);
SYSTEM_THREAD(ENABLED);

int Counter = 0x00;

void setup()
{
    delay(10000);
    Serial.begin(9600);
    StartUpMessage();

    RTC.Initialize();
    RTC.EnableSQW(true, BQ32000_IRQ, NULL);

    SleepConfig.mode(SystemSleepMode::HIBERNATE).gpio(BQ32000_IRQ, FALLING);
}

void StartUpMessage(void)
{
    Serial.printlnf("[INFO] Device OS version: %s", System.version().c_str());
}

void loop()
{
    System.sleep(SleepConfig);
    if(Counter++ == 60)
    {
        Counter = 0x00;
        delay(10000);
    }
}

Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
[INFO] Device OS version: 1.5.2

Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
[INFO] Device OS version: 1.5.2

Serial connection closed. Attempting to reconnect...
Serial monitor opened successfully:
[INFO] Device OS version: 1.5.2

Using STOP instead of HIBERNATE will solve this problem and the software is working fine.

So what is wrong with the HIBERNATE mode?

HIBERNATE is what used to be called “Deep Sleep” which is documented to wake with a reset condition

Can you please give me a link with that note?

https://docs.particle.io/reference/device-os/firmware/argon/#sleep-classic-api-

Thank you. I only read the current sleep API, but this is helpful.

1 Like

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