Disabling Shell over UART at runtime on nRF52840

Hi,

I'm using nRF52840 with NCS 1.8 on the existing ongoing development project. 

Recently I implemented shell commands, to be used during testing procedure either via UART or RTT. I have shell working with the following configuration:

CONFIG_PRINTK=y
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_SHELL=y

CONFIG_UART_CONSOLE=y
CONFIG_SHELL_BACKEND_SERIAL=y

At the end of the test procedure I want to disable UART and measure power consumption of the board. I usually use the following function to disable it:

void disable_uart(void)
{
// Disable UART
NRF_UARTE0->TASKS_STOPTX = 1;
NRF_UARTE0->EVENTS_RXTO = 0;
NRF_UARTE0->TASKS_STOPRX = 1;
while (NRF_UARTE0->EVENTS_RXTO == 0)
{
}
NRF_UARTE0->EVENTS_RXTO = 0;
// disable whole UART 0 interface
NRF_UARTE0->ENABLE = 0;

NRF_UARTE0->PSEL.TXD = 0xFFFFFFFF;
NRF_UARTE0->PSEL.RXD = 0xFFFFFFFF;
}

however when shell is defined in config, consumption doesn't drop. I also tried to disable shell before disabling uart, using: 

shell_stop(shell);

shell_uninit(shell, NULL);

without success - shell did stop, however power consumption did not drop. What would be the correct procedure for disabling UART in this case? Am I missing some configs?

Same problem apply if I configure RTT as an shell backed- I cannot disable it and measure power consumption during runtime. 

Parents Reply Children
Related