This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Disabling nRF9160 UART during runtime

Hello,

I am currently working on incorperating the UART on the nRF9160 into my application to communicate with an nRF52. At present this is working well, with UART interrupts generating whenever I send send TX data to the nRF9160's UART1 peripheral.

From previous current measurements on my application, I have seen the DK fall to around 7uAs during a low power state. This was accomplished through the usual method of setting CONFIG_SERIAL=n int prj.conf. However, now that I am using the UART to run part of the application, I am unable to disable this option, which means both UART0 (usb-uart bridge) and UART1 (externally driven UART from a UMFT230XB-01 USB-UART breakout) are being used at runtime. This leads to an idle current of 600-700uAs.

I have had a look around the DevZone and found a couple of tickets about this issue but have not been able to see any kind of successful results in my application.

NRF_UARTE0->TASKS_STOPTX = 1;
NRF_UARTE0->TASKS_STOPRX = 1;

NRF_UARTE1->TASKS_STOPTX = 1;
NRF_UARTE1->TASKS_STOPRX = 1;

The above doesn't prevent UART0 from printing to the Serial port. It also causes the UART1 callback to trigger constantly, reporting that it detects either the '\n' or '\r' characters in the UART RX buffer (what I use to determine a complete message has arrived and the UART buffer is good for reading in a later function). It also doesn't stop the UART1 from receiving messages as the callback still sees a UART message.

NRF_UARTE1_NS->ENABLE = 0;

The above code is able to disable the UART1 peripheral but if used to enable UART1 with ENABLE=8 the device doesn't accept incoming UART messages. Using this disable to UART0 peripheral, the code also hangs immediately and triggers a WDT reset.

Are there any other methods to disable the UART peripherals that would allow for low current consumption without causing ineffective or unwanted behaviour?

EDIT:

Combining the two methods has yielded some results for the UART1 peripheral.

{
    NRF_UARTE1_NS->TASKS_STOPTX = 1;
    NRF_UARTE1_NS->TASKS_STOPRX = 1;

    NRF_UARTE1_NS->ENABLE = 0;
}

{
    NRF_UARTE1_NS->ENABLE = 8;
    
    NRF_UARTE1_NS->TASKS_STARTRX = 1;
    NRF_UARTE1_NS->TASKS_STARTTX = 1;
}

Using the above I can now control UART1 on and off but the same still occurs with UART0, the code hangs and WDT triggers to recover the device. Is there a similar method for UART0?

Related