Cannot put B404X to sleep with PMIC disabled

I cannot put the B404X (or any BSOM) into STOP or ULTRA_LOW_POWER sleep when I have disabled the PMIC. HBIERNATE is okay! I am testing this option because I don't plan on using the PMIC features. When I try some simple sleep test code, the B404X will not go to sleep. The LED just keeps breathing aqua blue. Sleep is never achieved.

Testing on Device OS 4.1.0 on the M.2 BSOM Evaluation board.

How I have disabled the PMIC:

    SystemPowerConfiguration conf;
    conf.feature(SystemPowerFeature::DISABLE);
    int res = System.setPowerConfiguration(conf); // returns SYSTEM_ERROR_NONE (0) in case of success

And here is my full code that I am testing with:

//Particle BSOM Sleep Test
//Testing sleep modes HIBERNATE, STOP or ULTRA_LOW_POWER

SYSTEM_MODE(MANUAL);

#define BTN D7

bool skip_hibernate = true;
bool PMIC_enabled = false;

// setup() runs once, when the device is first turned on.
void setup() {

  pinMode(BTN, INPUT_PULLUP);

  Serial.begin(9600);
  delay(1000);
  Serial.println("Starting up");

  if (initializePowerCfg()) {
    Serial.println("Configured PMIC successfully.");
  }
  else {
    Serial.println("Could not conig PMIC.");
  }

  if (!skip_hibernate) {
    Serial.println("Hibernating now");
    Cellular.on();  //Needed to enter true low-power / hibernate mode
    SystemSleepConfiguration sleep_hibernate;
    sleep_hibernate.mode(SystemSleepMode::HIBERNATE)
	  .gpio(BTN,FALLING);
    System.sleep(sleep_hibernate);
  }
  Serial.println("Entering loop");
  Serial.println();
}

// loop() runs over and over again, as quickly as it can execute.
void loop() {
  if (connectToParticle()) {
    Serial.println();
    Serial.println("Connected to Particle");

    Serial.println("Publishing data now.");
    char infoString[255];
    snprintf(infoString, sizeof(infoString),"{\"event1\":true}");
    Particle.publish("event1", infoString, PRIVATE);
    Particle.process();

    Serial.println("Entering sleep now");
    delay(2000);
    SystemSleepConfiguration sleep_standby;
    sleep_standby.mode(SystemSleepMode::STOP)
      .network(NETWORK_INTERFACE_CELLULAR)
      .flag(SystemSleepFlag::WAIT_CLOUD)
      .gpio(BTN, FALLING)
      .duration(30s); 
    System.sleep(sleep_standby);
  }
}


bool connectToParticle() {
    if (!Cellular.ready()) {
        Cellular.on();          // turn on the Modem
        Cellular.connect();     // Connect to the cellular network
        delay(500);
        if(!waitFor(Cellular.ready, 300000)) {
            return false;       // Connect to cellular - give it 5 minutes
        }
    }

    Particle.connect();
    if (!waitFor(Particle.connected, 30000)) {
        return false;
    }
    else {
        return true;
    }
}

bool initializePowerCfg() {
    Log.info("Initializing Power Config");
    const int maxCurrent = 3000;
    SystemPowerConfiguration conf;
    
    if (PMIC_enabled) {
      conf.powerSourceMaxCurrent(maxCurrent) // Set maximum current the power source can provide  3.5W Panel (applies only when powered through VIN)
          .powerSourceMinVoltage(3880) // Set minimum voltage the power source can provide (applies only when powered through VIN)
          .batteryChargeCurrent(896) // Set battery charge current
          .feature(SystemPowerFeature::DISABLE_CHARGING)
          .feature(SystemPowerFeature::PMIC_DETECTION)
          .feature(SystemPowerFeature::USE_VIN_SETTINGS_WITH_USB_HOST); // For the cases where the device is powered through VIN
                                                                        // but the USB cable is connected to a USB host, this feature flag
                                                                        // enforces the voltage/current limits specified in the configuration
                                                                        // (where by default the device would be thinking that it's powered by the USB Host)
    }
    else {
      conf.feature(SystemPowerFeature::DISABLE);
    }
    int res = System.setPowerConfiguration(conf); // returns SYSTEM_ERROR_NONE (0) in case of success
    Log.info("setPowerConfiguration=%d", res);
    if (res == 0) {
        return true;
    }
    else {
        return false;
    }
}

I’ll give this a go today, but I highly recommend staying away from Manual mode.
Semi Automatic with threading enabled is much safer.

The PMIC has nothing to do with sleep code and should not be applicable here.

Thanks Chris. I’ll admit I haven’t tried using semi-automatic or tried to enable system threading yet. In my greater application code I use Manual mode though, and it is required due to the timing of particular processes.

In my test code, if you change the PMIC_enabled variable to false, then it will disable the PMIC after a power cycle. The you won’t be able to sleep.

I sent you a follow-up via the ticket.

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