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

"app_uart_close()" cannot disable UART

Hi I am now working on a project which I use ble_app_uart_c as a reference. SDK 15.2 and used softdevice s132. In the project I need to disable the UART before it enters into System ON sleep mode. But when I measure the current using the PPK, the current consumption doesn't change after I close the UART using "app_uart_close". In the following snippet, you will see, I just initialize the UART module and close it after 5seconds. But the current consumption is still the same as shown in the figurre.

static void uart_init(void)
{
	uint32_t                     err_code;
	app_uart_comm_params_t const comm_params =
	{
		.rx_pin_no    = 8/*RX_PIN_NUMBER*/,
		.tx_pin_no    = 6/*TX_PIN_NUMBER*/,
		.rts_pin_no   = RTS_PIN_NUMBER,
		.cts_pin_no   = CTS_PIN_NUMBER,
		.flow_control = APP_UART_FLOW_CONTROL_DISABLED,
		.use_parity   = false,
#if defined (UART_PRESENT)
		.baud_rate    = UARTE_BAUDRATE_BAUDRATE_Baud115200
#else
		.baud_rate    = NRF_UARTE_BAUDRATE_115200
#endif
	};

	APP_UART_FIFO_INIT(&comm_params,
	                   UART_RX_BUF_SIZE,
	                   UART_TX_BUF_SIZE,
	                   uart_event_handle,
	                   APP_IRQ_PRIORITY_LOWEST,
	                   err_code);
	APP_ERROR_CHECK(err_code);
}

int main(void)
{
	uart_init();
	nrf_delay_ms(5000);	
	app_uart_close();
	nrf_delay_ms(100);
	
	for(;;)
	{

		idle_state_handle();
	}
	
}

Here is the one in which I just directly goes to system ON sleep and the current consumption is way more reduced.

int main(void)
{
	//uart_init();
	nrf_delay_ms(5000);	
	//app_uart_close();
	nrf_delay_ms(100);
	
	for(;;)
	{

		idle_state_handle();
	}
	
}

What's the reason for this. Is there any more else to do to disable UART totally? Really needs your help. Thanks.

Related