Hello!
I am in the final phase of development and currently focused on reducing power consumption of my device.
To improve power consumption I'd disable UART if not needed.
Strangely, my device requires more power if UART is disabled than if it is enabled.
6.7 mA disabled vs 0.95 mA enabled.
How do I fix this?
I am using SDK 15.3.0 with softdevice 6.1.1.
I am using the "nrf_serial.h" library to control my UART connection.
My serial communication is defined as following
#define UART_WRITE_TIMEOUT_MS 100 NRF_SERIAL_UART_DEF(serial_uart, 0); // variables static void serial_event_scheduler_handler(void *p_event_data, uint16_t event_size); // forward declaration static void serial_evt_handler(struct nrf_serial_s const *p_serial, nrf_serial_event_t event); // forward declaration // define serial fifo queue #define SERIAL_FIFO_TX_SIZE 32 #define SERIAL_FIFO_RX_SIZE 32 NRF_SERIAL_QUEUES_DEF(serial_queues, SERIAL_FIFO_TX_SIZE, SERIAL_FIFO_RX_SIZE); // define serial rx / tx buffer #define SERIAL_BUFF_TX_SIZE 1 #define SERIAL_BUFF_RX_SIZE 1 NRF_SERIAL_BUFFERS_DEF(serial_buffs, SERIAL_BUFF_TX_SIZE, SERIAL_BUFF_RX_SIZE); // define serial configuration NRF_SERIAL_CONFIG_DEF(serial_config, NRF_SERIAL_MODE_IRQ, &serial_queues, &serial_buffs, &serial_evt_handler, NULL); // define uart config NRF_SERIAL_DRV_UART_CONFIG_DEF(m_uart0_drv_config, RX_PIN, TX_PIN, 0, 0, NRF_UART_HWFC_DISABLED, NRF_UART_PARITY_EXCLUDED, NRF_UART_BAUDRATE_19200, UART_DEFAULT_CONFIG_IRQ_PRIORITY);
And I use the following code for initialization
APP_ERROR_CHECK(nrf_serial_init(&serial_uart, &m_uart0_drv_config, &serial_config)); /* nrf_serial_tx_abort(&serial_uart); nrf_serial_rx_drain(&serial_uart); APP_ERROR_CHECK(nrf_serial_uninit(&serial_uart)); *(volatile uint32_t *)0x40002FFC = 0; // Power down UARTE0 *(volatile uint32_t *)0x40002FFC; // *(volatile uint32_t *)0x40002FFC = 1; // Power on UARTE0 so it is ready for next time*/
As you can see I have already tried different solutions found in this forum like https://devzone.nordicsemi.com/f/nordic-q-a/26030/how-to-reach-nrf52840-uarte-current-supply-specification/102605#102605