Hi Team,
Got a high current issue with uart from customer.
When the nrf_serial_init() is called and the uart is configured as dma mode(used as UARTE), the average current is ~500uA even nrf_serial_uninit() is called before going to sleep.
There is no such issue if the uart is configured as legacy uart mode(used as UART).
The testing code is as below and verified in the ble_app_hrs_freertos example which in normal case is just ~40uA average current.
The SDK version is v15.0.0
I suspect there is a bug in the chip.
Could you help to check?
Thanks.
void serial_init()
{
ret_code_t ret;
ret = nrf_serial_init(&serial_uart, &m_uart0_drv_config, &serial_config);
APP_ERROR_CHECK(ret);
}
void serial_uinit()
{
nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STOPTX);
nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STOPRX);
bool txstop;
bool rxto;
do {
txstop = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED);
rxto = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_RXTO);
} while ((!txstop) && (!rxto));
nrf_serial_uninit(&serial_uart);
// nrf_uarte_rx_buffer_set(NRF_UARTE0, NULL, 0);
}
/**@brief Function for application main entry.
*/
int main(void)
{
bool erase_bonds;
// Initialize modules.
log_init();
clock_init();
// Do not start any interrupt that uses system functions before system initialisation.
// The best solution is to start the OS before any other initalisation.
#if NRF_LOG_ENABLED
// Start execution.
if (pdPASS != xTaskCreate(logger_thread, "LOGGER", 256, NULL, 1, &m_logger_thread))
{
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
#endif
// Activate deep sleep mode.
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
// Configure and initialize the BLE stack.
ble_stack_init();
#if 1
sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
#endif
// Initialize modules.
timers_init();
buttons_leds_init(&erase_bonds);
gap_params_init();
gatt_init();
advertising_init();
services_init();
sensor_simulator_init();
conn_params_init();
peer_manager_init();
application_timers_start();
serial_init();
serial_uinit();
// Create a FreeRTOS task for the BLE stack.
// The task will run advertising_start() before entering its loop.
nrf_sdh_freertos_init(advertising_start, &erase_bonds);
NRF_LOG_INFO("HRS FreeRTOS example started.");
// Start FreeRTOS scheduler.
vTaskStartScheduler();
for (;;)
{
APP_ERROR_HANDLER(NRF_ERROR_FORBIDDEN);
}
}