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

Reducing current draw when UART is idle.

I have an application that needs to minimize its current consumption when sleeping. From the nRF52 manual, I see that UART should consume 1uA when in idle. The total current draw (CPU sleeping + UART idle) that I'm expecting should be around 2.5uA-3.0uA given another peripheral. However, I measure around 8uA - around 5uA too high.

To narrow down this problem, I put together a small project based on the SDK's uart example. Here is the main:

int main(void)
{
   NRF_GPIO->DIRSET = 0xFFFFFFFC;  // Exclude XTAL
   NRF_GPIO->OUTCLR = 0xFFFFFFFC;

   uint32_t err_code;
   const app_uart_comm_params_t comm_params =
   {
      16, // RX
      17, // TX
      255, // RTS
      255, // CTS
      APP_UART_FLOW_CONTROL_DISABLED, 
      false,
      UART_BAUDRATE_BAUDRATE_Baud38400
   };

   APP_UART_FIFO_INIT(&comm_params,
                     UART_RX_BUF_SIZE,
                     UART_TX_BUF_SIZE,
                     uart_error_handle,
                     APP_IRQ_PRIORITY_LOW,
                     err_code);

  APP_ERROR_CHECK(err_code);


  uint8_t i;

  NRF_CLOCK->TASKS_HFCLKSTOP = 1;
  NRF_UART0->TASKS_SUSPEND = 1;
  NRF_UART0->INTENCLR = (UART_INTENCLR_TXDRDY_Clear << UART_INTENCLR_TXDRDY_Pos) | (UART_INTENCLR_RXDRDY_Clear << UART_INTENCLR_RXDRDY_Pos); // disable both ready interrupt
  NRF_UART0->INTENCLR = (UART_INTENCLR_CTS_Clear << UART_INTENCLR_CTS_Pos) | (UART_INTENCLR_RXTO_Clear << UART_INTENCLR_RXTO_Pos); // disable both ready interrupts
  
while (true)
{
   __SEV();
   __WFE();
   __WFE();
}

}

The only way I manage to get to the minimal draw is to disable UART completely using:

 NRF_UART0->ENABLE = 0;

I don't believe this is another peripheral because (a) I haven't enabled anything else, and (b) disabling UART gets it to the proper level.

How do I get the UART peripheral into the 1uA idle mode? Disabling the UART completely seems a bit drastic.

I am running this on a Rev. C nRF52 chip.

Related