Hello,
We are experiencing an issue when putting the nRF52840 back to a low-power state after having had UART configured for double buffering. For context we are using nRF5 SDK v15.3.0.
We have reverted to a very simple example application which does the following:
1. Initialize UART with the following configuration:
nrfx_uarte_config_t uarte_config { .pseltxd = NRF_GPIO_PIN_MAP(0, 30), .pselrxd = NRF_GPIO_PIN_MAP(0, 29), .pselcts = NRF_UARTE_PSEL_DISCONNECTED, .pselrts = NRF_UARTE_PSEL_DISCONNECTED, .p_context = nullptr, .hwfc = NRF_UARTE_HWFC_DISABLED, .parity = NRF_UARTE_PARITY_EXCLUDED, .baudrate = NRF_UARTE_BAUDRATE_115200, .interrupt_priority = NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY }; nrfx_uarte_init(&diag_uarte_instance, &uarte_config, uarte_event_handler);
2. Setup a RX transfer for either a) single-buffering or b) double-buffering -> based on the following usage description "The secondary buffer can be set immediately after starting the transfer and will be filled when the primary buffer is full":
a)
nrfx_uarte_rx(&diag_uarte_instance, &rx0, 1);
b)
nrfx_uarte_rx(&diag_uarte_instance, &rx0, 1); nrfx_uarte_rx(&diag_uarte_instance, &rx1, 1);
3. Transfer something over UART to trigger event handler
4. Un-initialize the UART on the event handler being triggered (we don't care about the data in this test case)
static void uarte_event_handler(const nrfx_uarte_event_t* p_event, void* p_context) { nrfx_uarte_uninit(&diag_uarte_instance); }
5. Finally, call nrf_pwr_mgmt_run()
to wait until next event
We find that in the case of 2.a) the processor will return to a low-power state (~3.6uA) after the transfer, however in 2.b) it will not. We also experimented with use of nrfx_uarte_rx_abort
but this seems to be unrelated.
We can likely work around the issue in the short term (simply by single buffering), however would like to understand where the issue lies so it can be improved in the future.
Any insight you can offer would be much appreciated,
Rob