Hi all, I’ve been reading the reference and tutorials to better understand replacing mesh with BLE, but I’ve hit a bit of a roadblock with BLE advertising with the intent to wake from sleep 2.0. Perhaps, I’m misunderstanding what I thought this should do, but if I start advertising then go to sleep with both .ble() and .duration() sleep config, my argon give the red SOS instead of sleeping. However, this works fine on a xenon for some reason. What silly mistake am I making?
If I remove any one of the three: ble wake, duration wake, or advertising, then the argon has no issue.
// run in manual mode for BLE offline mode
SYSTEM_MODE(MANUAL);
//BLE setup
const BleUuid serviceUuid("7cf29a2d-f244-45e3-8bd3-f4b86c974677");
BleAdvertisingData bleData;
SystemSleepConfiguration config;
void setup() {
// give a human a chance to see the white LED
delay(5000);
// turn on BLE because we're in manual mode
BLE.on();
// create the data for advertising and advertise
bleData.appendServiceUUID(serviceUuid);
BLE.advertise();
// example sleep config from argon reference
config.mode(SystemSleepMode::STOP);
config.duration(15s);
config.ble();
}
void loop() {
delay(1000);
System.sleep(config);
}
Unfortunately, the main problem is the wakeup that you set, in this case, the Argon can’t use the time to wake up the device, you need to use a pin.
If you delete the line
config.duration(15s);
the code works, but the device never wakes up.
Take a look at the documentation to read more about this:
Thanks for the reply, @ismaelSB. The documentation you pasted says there’s a limit of 24 days in STOP mode, and elsewhere in the documentation it also says that the RTC is active in STOP mode. Part of my config is specifying SystemSleepMode::STOP, so shouldn’t this code still work?
Hey Steve,
I understand the same as you from the docs:
The SystemSleepMode::STOP mode is the same as the classic stop sleep mode (pin or pin + time).
Real-time clock (RTC) is kept running.
BLE is kept on if used as a wake-up source (Gen 3 devices only).
Can wake from: Time, GPIO, analog, serial, and cellular. On Gen 3 also BLE and Wi-Fi.
@mariano , have you done any tests with Bluetooth and sleep?
thanks