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

Cannot receive UART data

I'm using the nRF52 DK with SDK 15.3.0. At this point I'm trying to get a UART loop back to work by tying the TX pin (P0.8) to the RX pin (P0.9). I have verified that the RX GPIO is set for an input and the input buffer is connected. My project is based on the "ble_app_uart" project. I see what looks like reasonable data going out on the TX pin but I never get the APP_UART_DATA_READY event in the event handler. I do get the APP_UART_TX_EMPTY event after sending the string of 4 bytes but do not get any other events. I have also tried putting a 50mS delay after sending a byte with "app_uart_put" then calling "app_uart_get" and it returns NRF_ERROR_NOT_FOUND indicating no data to read.

Looking at the UARTE0 registers after sending the data, EVENTS_RXSTARTED is a 1 and EVENTS_RXDRDY and EVENTS_ENDRX are both 0. The ENDRX interrupt is enabled, the RXD PTR is set to an address in RAM, the MAXCNT is 1 and AMOUNT is 0.

Here is my UART initialization code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void uart_init(void)
{
uint32_t err_code;
app_uart_comm_params_t const comm_params =
{
.rx_pin_no = PIC_TXD_BITNUM,
.tx_pin_no = PIC_RXD_BITNUM,
.rts_pin_no = 0xffffffff, /* indicates pin isn't used */
.cts_pin_no = 0xffffffff, /* indicates pin isn't used */
.flow_control = APP_UART_FLOW_CONTROL_DISABLED,
.use_parity = false,
.baud_rate = NRF_UART_BAUDRATE_115200
};
APP_UART_FIFO_INIT(&comm_params,
UART_RX_BUF_SIZE, /* 256 byte buffer */
UART_TX_BUF_SIZE, /* 256 byte buffer */
uart_event_handler,
APP_IRQ_PRIORITY_LOWEST,
err_code);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I get the same results with two nRF52 DK boards. Any ideas?