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

UART Peripheral Dead?

I've been developing an application on the nrf51 DK based on the ble uart application and it's been working fine. I've ported it to a custom board running at 1.8V and attached a 1.8V USB-UART adaptor to debug the UART output but after printing a few messages it stopped working.

Now whenever I try to do a printf or any other kind of TX on the UART interface I get an APP_UART_COMMUNICATION_ERROR with error code 4. I can still toggle the lines manually when configured as GPIOs.

Any thoughts on what might have happened or how to debug if the uart is really dead?

EDIT:

I ended up commenting out the call to APP_ERROR_HANDLER in the UART ISR and now things are working as expected. I guess the UART goes into a bad state on the first attempt to transmit and the error handler just resets the device?

/**@brief UART event handler
 */
void uart_event_handle(app_uart_evt_t * p_event)
{
	static uint8_t data_array[256];
	static uint8_t index = 0;
	uint32_t       err_code;

	switch (p_event->evt_type)
	{
		case APP_UART_DATA_READY:
			UNUSED_VARIABLE(app_uart_get(&data_array[index]));
			index++;
			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;
	}  
}

EDIT:

It turns out the RX line floating was causing issues.

Related