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

APP_UART_COMMUNICATION_ERROR occur when uart cable plug/unplug. 

Thanks in advanced. Platform is: nrf52832-qfaa, SDK_17.0.2. I use microusb interface as multiple port for charging and uart I/O. I always get APP_UART_COMMUNICATION_ERROR when cable plug/unplug:

static void uart_event_handle(app_uart_evt_t * p_event)
{
	switch (p_event->evt_type)
	{
		case APP_UART_DATA_READY:
			break;

		case APP_UART_COMMUNICATION_ERROR:
			APP_ERROR_HANDLER(p_event->data.error_communication);
			break;

		case APP_UART_FIFO_ERROR:
			APP_ERROR_HANDLER(p_event->data.error_code);
			break;

		default:
			break;
	}
}
static void uart_init(void)
{
	uint32_t		err_code;
	app_uart_comm_params_t const comm_params =
	{
		.rx_pin_no			= 11,
		.tx_pin_no			= 12,
		.rts_pin_no 		= 17, 
		.cts_pin_no 		= 18, 
		.flow_control		= APP_UART_FLOW_CONTROL_DISABLED, 
		.use_parity 		= false, 

#if defined 							(UART_PRESENT)
		.baud_rate			= NRF_UART_BAUDRATE_115200

#else

		.baud_rate			= NRF_UARTE_BAUDRATE_115200
#endif
	};

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

I think it is nothing special to codes. Level of rx pin 11 is updated suddenly when cable plug/unplug, which causes this error. I try to pullup or pulldown rx pin 11 at the beginning, it's useless, and trigger an other no_mem error. Would experts help me?

Parents Reply Children
No Data
Related