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

Cannot communicate over UART

Hello,

I have some problems with UART communication with my nRF51 DK. When I connect it through USB cable, all is ok. But when I connect pins: P0.09(TXD), P0.11(RXD) to my USB/UART converter, nothing happens on terminal. I have also custom board with nRF51822 and the same problem. I tried to use:

app_uart_put();
printf();

Below is my uart config:

void uart_init(void)
{
uint32_t err_code;

const app_uart_comm_params_t comm_params =
  {
    .rx_pin_no    = RX_PIN_NUMBER,
    .tx_pin_no    = 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,
    .baud_rate    = UART_BAUDRATE_BAUDRATE_Baud115200
  };

APP_UART_FIFO_INIT(&comm_params,
                    UART_RX_BUF_SIZE,
                    UART_TX_BUF_SIZE,
                    uart_event_handle,
                    APP_IRQ_PRIORITY_LOW,
                    err_code);

APP_ERROR_CHECK(err_code);

uart_rx_buffer.p_data = malloc(UART_RX_BUF_SIZE * sizeof(uint8_t));
memset(uart_rx_buffer.p_data, 0, UART_RX_BUF_SIZE*sizeof(uint8_t));
uart_rx_buffer.size = 0;
}

EDIT

I tried also set uart flow control enabled and use additional pins: CTS and RTS. Still I can't communicate with nRF51422 on my nRF51DK by connecting those four pins with USB/UART converter. My program works fine when I set default RX,TX, RTS and CTS pins and connect nRF51DK to my computer directly throught USB cable.

  • It seems nrf51822 UART MCU expects a DTR from the remote end(DTE) while connecting to external MCU over USB. Works fine with termite on PC as it uses Virtual COM port/ CDC and software raises DTR in order to wake up the nrf51822 MCU. Arduino doesn't support this with it's USB CDC.

  • well that has nothing to do with the original question at all, which was about using the UART not over USB. The requirement for DTR from the remote end has nothing to do with the nrf51822 MCU either, the requirement for DTR comes from the interface MCU, the Atmel/Segger chip; and that requirement is documented in the devkit user guide.

  • Thanks! I got direct UART with external MCU(Arduino) working using the default config with HWFC disabled & UART pin 11 for Rx (unidirectional and didn't use TX) and connecting the grounds.

1 2