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

Power consumption nRF52840-DK in sleep mode while using UART

Hello,
I'm trying to get sleep mode working on a nRF52840-DK with Zephyr or Mbed OS while using UART.
It is possible to achieve low current consumption in sleep mode (~3µA) while using I2C or SPI. The current remains at ~900µA in sleep mode when I use UART. I've even tried to delete the serial object before entering sleep mode without any effect.
Is it possible to achieve a low current consumption (<10µA) with UART using Mbed OS or Zephyr? UART doesn't have to be enabled during sleep mode.
Thank You!
  • Hi,

    Is the HFCLK still running? What function are you using to set it in sleep mode, and could you share your project?

    regards

    Jared 

  • Hi,

    i am just trying to figure out what is happening.

    So what i have found out is that i got around 10uA current consumption with next setup:

    main.cpp

      EventQueue mainEventQueue(64 * EVENTS_EVENT_SIZE);
      Thread mainEventQueueThread(osPriorityNormal, OS_STACK_SIZE, NULL, "MAIN.event.queue");
      DebounceIn button1(BUTTON1);
      DigitalOut led(LED1);
      
      void onButton1Rise() {
          led = !led;
      }
      
      int main() {
          NRF_POWER->DCDCEN = 0x00000001;
          NRF_UICR->NFCPINS = 0x00000000;
          mbed_file_handle(STDIN_FILENO)->enable_input(false);
          mainEventQueueThread.start(callback(&mainEventQueue, &EventQueue::dispatch_forever));
          button1.rise(mainEventQueue.event(onButton1Rise));
      }

    mbed_app.json

      {
      	"target_overrides": {
      		"*": {
      			"platform.stdio-baud-rate": 115200,
      			"platform.stdio-convert-newlines": true,
      			"target.console-uart": false,
      			"target.device_has" : [
      				"STDIO_MESSAGES"
      			],
      			"target.features_add": ["BLE"],
      			"platform.cpu-stats-enabled": 1,
      			"platform.thread-stats-enabled": 1,
      			"platform.error-filename-capture-enabled": true,
      			"target.macros_add": [
      				"DEVICE_SLEEP",
      				"MBED_TICKLESS",
      				"DEVICE_LPTICKER",
      				"MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER=0"
      			],
      			"platform.callback-nontrivial": true
      		}
      	}
      }

    my board:

    but after i created BufferedSerial object and delete it i got 600uA.

    So i was looking at the registers and found out the next thing:

    LOW CURRENT

    Registers in UART0:
    	TASKS_STARTRX:  (not readable)  Start UART receiver
    	TASKS_STOPRX:   (not readable)  Stop UART receiver
    	TASKS_STARTTX:  (not readable)  Start UART transmitter
    	TASKS_STOPTX:   (not readable)  Stop UART transmitter
    	TASKS_SUSPEND:  (not readable)  Suspend UART
    	EVENTS_CTS:                  0  CTS is activated (set low). Clear To Send.
    	EVENTS_NCTS:                 0  CTS is deactivated (set high). Not Clear To Send.
    	EVENTS_RXDRDY:               0  Data received in RXD
    	EVENTS_TXDRDY:               0  Data sent from TXD
    	EVENTS_ERROR:                0  Error detected
    	EVENTS_RXTO:                 0  Receiver timeout
    	SHORTS:                      0  Shortcuts between local events and tasks
    	INTENSET:                    0  Enable interrupt
    	INTENCLR:                    0  Disable interrupt
    	ERRORSRC:                    0  Error source
    	ENABLE:                      0  Enable UART
    	PSEL:                       -1  Unspecified
    	RXD:                         0  RXD register
    	TXD:            (not readable)  TXD register
    	BAUDRATE:             67108864  Baud rate. Accuracy depends on the HFCLK source selected.
    	CONFIG:                      0  Configuration of parity and hardware flow control
    Registers in UARTE0:
    	TASKS_STARTRX:     (not readable)  Start UART receiver
    	TASKS_STOPRX:      (not readable)  Stop UART receiver
    	TASKS_STARTTX:     (not readable)  Start UART transmitter
    	TASKS_STOPTX:      (not readable)  Stop UART transmitter
    	TASKS_FLUSHRX:     (not readable)  Flush RX FIFO into RX buffer
    	EVENTS_CTS:                     0  CTS is activated (set low). Clear To Send.
    	EVENTS_NCTS:                    0  CTS is deactivated (set high). Not Clear To Send.
    	EVENTS_RXDRDY:                  0  Data received in RXD (but potentially not yet transferred to Data RAM)
    	EVENTS_ENDRX:                   0  Receive buffer is filled up
    	EVENTS_TXDRDY:                  0  Data sent from TXD
    	EVENTS_ENDTX:                   0  Last TX byte transmitted
    	EVENTS_ERROR:                   0  Error detected
    	EVENTS_RXTO:                    0  Receiver timeout
    	EVENTS_RXSTARTED:               0  UART receiver has started
    	EVENTS_TXSTARTED:               0  UART transmitter has started
    	EVENTS_TXSTOPPED:               0  Transmitter stopped
    	SHORTS:                         0  Shortcuts between local events and tasks
    	INTEN:                          0  Enable or disable interrupt
    	INTENSET:                       0  Enable interrupt
    	INTENCLR:                       0  Disable interrupt
    	ERRORSRC:                       0  Error source Note : this register is read / write one to clear.
    	ENABLE:                         0  Enable UART
    	PSEL:                          -1  Unspecified
    	BAUDRATE:                67108864  Baud rate. Accuracy depends on the HFCLK source selected.
    	RXD:                            0  RXD EasyDMA channel
    	TXD:                            0  TXD EasyDMA channel
    	CONFIG:                         0  Configuration of parity and hardware flow control

    HI CURRENT

    Registers in UART0:
    	TASKS_STARTRX:  (not readable)  Start UART receiver
    	TASKS_STOPRX:   (not readable)  Stop UART receiver
    	TASKS_STARTTX:  (not readable)  Start UART transmitter
    	TASKS_STOPTX:   (not readable)  Stop UART transmitter
    	TASKS_SUSPEND:  (not readable)  Suspend UART
    	EVENTS_CTS:                  1  CTS is activated (set low). Clear To Send.
    	EVENTS_NCTS:                 0  CTS is deactivated (set high). Not Clear To Send.
    	EVENTS_RXDRDY:               0  Data received in RXD
    	EVENTS_TXDRDY:               1  Data sent from TXD
    	EVENTS_ERROR:                0  Error detected
    	EVENTS_RXTO:                 0  Receiver timeout
    	SHORTS:                     32  Shortcuts between local events and tasks
    	INTENSET:               524304  Enable interrupt
    	INTENCLR:               524304  Disable interrupt
    	ERRORSRC:                    0  Error source
    	ENABLE:                      8  Enable UART
    	PSEL:                       -1  Unspecified
    	RXD:                         0  RXD register
    	TXD:            (not readable)  TXD register
    	BAUDRATE:              2576384  Baud rate. Accuracy depends on the HFCLK source selected.
    	CONFIG:                      0  Configuration of parity and hardware flow control
    Registers in UARTE0:
    	TASKS_STARTRX:     (not readable)  Start UART receiver
    	TASKS_STOPRX:      (not readable)  Stop UART receiver
    	TASKS_STARTTX:     (not readable)  Start UART transmitter
    	TASKS_STOPTX:      (not readable)  Stop UART transmitter
    	TASKS_FLUSHRX:     (not readable)  Flush RX FIFO into RX buffer
    	EVENTS_CTS:                     1  CTS is activated (set low). Clear To Send.
    	EVENTS_NCTS:                    0  CTS is deactivated (set high). Not Clear To Send.
    	EVENTS_RXDRDY:                  0  Data received in RXD (but potentially not yet transferred to Data RAM)
    	EVENTS_ENDRX:                   0  Receive buffer is filled up
    	EVENTS_TXDRDY:                  1  Data sent from TXD
    	EVENTS_ENDTX:                   0  Last TX byte transmitted
    	EVENTS_ERROR:                   0  Error detected
    	EVENTS_RXTO:                    0  Receiver timeout
    	EVENTS_RXSTARTED:               0  UART receiver has started
    	EVENTS_TXSTARTED:               1  UART transmitter has started
    	EVENTS_TXSTOPPED:               0  Transmitter stopped
    	SHORTS:                        32  Shortcuts between local events and tasks
    	INTEN:                     524304  Enable or disable interrupt
    	INTENSET:                  524304  Enable interrupt
    	INTENCLR:                  524304  Disable interrupt
    	ERRORSRC:                       0  Error source Note : this register is read / write one to clear.
    	ENABLE:                         8  Enable UART
    	PSEL:                          -1  Unspecified
    	BAUDRATE:                 2576384  Baud rate. Accuracy depends on the HFCLK source selected.
    	RXD:                    536877297  RXD EasyDMA channel
    	TXD:                    536877304  TXD EasyDMA channel
    	CONFIG:                         0  Configuration of parity and hardware flow control

    So the UART is not deinited for some reason.

    After i did:

    stdio.enable_input(false);
    stdio.enable_output(false);
    

    the current dropped again init value.

  • Hi,

    Could you create a new ticket for your issue?

    regards

    Jared

Related