We are developing nRF52840 battery powered device, NCS 2.5.2.
Wanted to use shell for external commands for system testing (currents must be low when the debugger is not connected) - only in debug build, so this is not critical for production build.
Everything works as expected when RTT is connected (1.77 mA for debug probe) but when RTT gets disconnected (or board starts without debugger connected), the current is ~4 uA until I guess the RTT buffer fills up and current jumps to 3.45 mA and stays indefinitely while the application keeps running (ble/nfc responding). Changing the RTT_BUFFER_SIZE_UP changes how long it takes for the current to jump to 3.45 mA.
My guess is that SHELL_BACKEND_RTT is configured to the default mode (RTT_MODE_BLOCK). Is there a way to force RTT_MODE_OVERWRITE (as in CONFIG_LOG_BACKEND_RTT_MODE_OVERWRITE)? I also tried CONFIG_SEGGER_RTT_MODE_NO_BLOCK_TRIM=y, but it did not help.
Add following configs:
replace main function with:
int main(void) { if (IS_ENABLED(CONFIG_SHELL_START_OBSCURED)) { login_init(); } while (1) { LOG_WRN("HELLLLLLLLLOOOOOOOO"); k_sleep(K_MSEC(1000)); } return 0; }
Connect with some RTT viewer - the RTT buffer gets dumped, Disconnect RTT. If current remains up, the MCU may be left halted (1.8 mA), run nrfjprog --run and the cycle continues.