Hi,
I have a device reading analog inputs and have seen that they are not being restored after waking from a sleep. This is the normal sleep not the deep sleep.
I thought it was my code but tried this with the ota_example and it shows the same issue. Is latest libmDot for xDot, not development branch with correct mbed-os 5.4.7 for this library release.
[INFO] version —————— 3.0.0-mbed144
[INFO] current channel plan —– EU868
The code is there to read the LUX sensor on the xDot DK but I didnt use this, the alternative for mDot was to use the analog input. To reproduce, I forced the example ota_example.cpp to use AnalogIn
//#if defined(TARGET_XDOT_L151CC)
//I2C i2c(I2C_SDA, I2C_SCL);
//ISL29011 lux(i2c);
//#else
AnalogIn lux(PB_0);
//#endif
Where the sensor was read, this was also updated.
The first time after a successful join I see in the output:
[INFO] RxDone 33 bytes RSSI: -58 dB SNR: 77 cB
[INFO] Network joined
[INFO] Packet RSSI: -58 dB SNR: 77 cB
[INFO] light: 62143 [0xF2BF]
[INFO] Preparing frame
[INFO] Configure radio for TX
[INFO] Configure radio for TX
[INFO] Rx Window 1
[INFO] Rx Window 2
[INFO] successfully sent data to gateway
[INFO] sleeping 10s or until interrupt on WAKE pin
[INFO] application will resume after waking up
[INFO] entering sleep (stop) mode 00000037
Now the next time I see:
[WARNING] Fixed the TIM_MST prescaler
[INFO] light: 0 [0x0000]
[INFO] Preparing frame
[INFO] Configure radio for TX
[INFO] Configure radio for TX
[INFO] Rx Window 1
[INFO] Rx Window 2
[INFO] successfully sent data to gateway
[INFO] sleeping 10s or until interrupt on WAKE pin
[INFO] application will resume after waking up
[INFO] entering sleep (stop) mode 00000037
The Light value is now 0.
I am using
sleep_wake_rtc_or_interrupt(deep_sleep);
with a deep_sleep value of false.
If I update the function sleep_wake_rtc_or_interrupt to replace the actual sleep with a wait then analog port is read correctly each time.
// dot->sleep(delay_s, mDot::RTC_ALARM_OR_INTERRUPT, deepsleep);
wait(delay_s);
Is there an issue that the analog inputs are not being restored correctly?
Regards
Andrew