Deep sleep with BG96

Hello,

I have a problem and no more ideas how to fix it :wink: Maybe some facts at the beginning:

  • MbedOS version: 5.15.1
  • MCU: NRF52840
  • QUECTEL BG96

I’ve tried to put MCU to deep sleep. If I call:

CellularDevice::get_default_instance()->get_file_handle().enable_input(false);
CellularDevice::get_default_instance()->get_file_handle().enable_output(false);

before connecting to network (i.e. mcc_platform_init_connection) then MCU goes to sleep (and ofc there is no connection with network).

Unfortunately after connecting to network there is no longer possibility to sleep. I’ve tried to turn on modem and call enable_output/input, as well as directly calling disable_rx_irq in BG96’ UARTSerial object (I’ve made it available in the interface). I can see in logs, that modem has disconnected and turned off, but MCU not longer sleep.

Is there something missing in my implementation? I’ve tried to find anything related to this issue, but only found enable_input/output reference.

Thanks
Igor

Are you seeing the logs from stdio output? Maybe you are not disabling all the needed peripherals, see Power management

Yes, I see logs. It think that modem is the main problem, but I don’t have ideas how to fix this. Based on the gdb and serial output I think, that UARTSerial Rx is blocking:

  • LOCK: SerialBase.cpp, ln: 112, lock count: 1
  • and debug session which points to QUECTEL_BG96.cpp:144 (static UARTSerial in get_default_instance).

And weird thing is that if I disable input/output of this serial before connecting to cellular network, then MCU is able to sleep. But if I do this afterwards then it no longer sleeps.