Sleep mode ULTRA_LOW_POWER giving error code -120

I am trying to use SystemSleepMode::ULTRA_LOW_POWER to test out the battery life of my Boron board. I am not able to activate the Ultra-low power mode. the STOP mode works for me and has been tested but am not able to use the ultra low power function. I am getting error code -120 when I try using it. Can someone please help? Thank you.
This is the test code I have so far:

int ledD6 = D6;
SystemSleepConfiguration config;

void setup() {
pinMode(ledD6, OUTPUT);
digitalWrite(ledD6, HIGH);
delay(1s);
}
void loop() {
digitalWrite(ledD6, LOW);
delay(1s);
config.mode(SystemSleepMode::ULTRA_LOW_POWER).duration(1min);
//SystemSleepResult result = System.sleep(config);
//Serial.println(result.error());
digitalWrite(ledD6, HIGH);
delay(20s);
}

Hi Mohammed, and welcome to the community!

Most probably this will not help, but here goes nonetheless.
The first thing I would check is the version of DeviceOs, since the docs here say that this is new starting 2.0.0:

ULTRA_LOW_POWER (SystemSleepMode)
Since 2.0.0:
The SystemSleepMode::ULTRA_LOW_POWER mode is similar to STOP mode however internal peripherals such as GPIO, UART, ADC, and DAC are turned off. Like STOP mode, the RTC continues to run but since many more peripherals are disabled, the current used is closer to HIBERNATE. It is available in Device OS 2.0.0 and later.

What is the Device OS version on your Boron?
thanks,
Gustavo.

Good catch Gustavo, I did not notice the 2.0.0 part :sweat_smile: . I am running 1.5.2. Is 2.0.0. still Beta?

Thank you!

oh ok, that explains the error then.
Yes, 2.0.0 is in pre-release, so only you can ponder if you want to use it or not.
More info here:

Cheers
Gustavo.