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.

  • Do it work with other pins? Do it work with the onboard chip if you disable HW flow control?

    Your code might run into an error condition and reset, see here.

  • No, it is not working with other pins. When i disable HW flow control it is working, but only with usb pluged into devkit, not working through pins connected to USB/UART converter. I tried examples with UART form SDK and it behaves in the same way. So it should not be an error condition and reset. As I mentioned before, the same code runs ok when USB cable is connected to board, but when I try to connect UART pins to the USB/UART converter it is not working.

  • Pins P0.9 and 0.11 are already used by the onboard segger, you can't connect the same pins to two UARTS, it's not going to work. Choose pins which are NOT used by the onboard segger or anything else and use those.

  • Thank you for your answer, RK. I tried other pins(P0.12-P0.16), but result is the same - nothing on terminal. Any other clues?

    Below I paste my post from deleted topic:

    Hello,

    Could somebody tell me how to proper use UART pins located on my nRF51DK board?

    I connected RX(P0.11), CTS(P0.10), TX(P0.09), RTS(P0.08) and GND to the relevant pins on my USB/UART converter connected to the PC. DK is powered throught USB cable connected to the PC. I tested ble_app_uart example and these are the results:

    In terminal I connected to port COM of USB/UART and nothing happens, even after i restarted board. After that i connected to port COM of USB cable connected directly to the DK and program works well.

    So, how should I use these UART pins on my board?

  • perhaps your UART/USB converter doesn't work, or you're using the wrong baud rate, or the wrong flow control. There's really nothing else to suggest, you've connected the pins, you're running the code, if it doesn't work then you need to get a signal analyser on it and see what's going on.

Related