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

Question about uart connection

Hi there,

I am developing an application that uses UART. I am wondering what's the proper way to connect the nRF52840 to the PC. I researched online and found that I could use a serial TTL to USB converter to first connect the pins to the converter, which then uses a USB to USB cable to the PC. Is this the recommended way?

If it is, what pins should I connect on the board? From the tutorial (https://youtu.be/gO4YiHNxBBY), it seems like I need to connect Gnd pin of the converter to the nRF ground. For the nRF52840, which pin is this referring to? Then, I need to connect the Tx pin to Tx pin, and the Rx pin to Rx pin. Hence, I really need some pointers on which pins to connect.

On the other hand, I also noticed that there is another micro USB port that resides between the reset button and the four push buttons. I wonder if this port can be used for UART. If so, how could I use it?

Thanks,

Jinyue

  • Yes! You are correct. P0.8 as rx and P0.6 as tx. connect the node which are red circle from your side. But,...You may disable the UART flow control . Because you don't need the CTS and RTS pins. The following code you may take for reference....

    /**@brief Function for initializing the UART.
    */
    static 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, //APP_UART_FLOW_CONTROL_ENABLED,
    .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_LOWEST,
    err_code);

    APP_ERROR_CHECK(err_code);
    }

    void uart_printf(const uint8_t * str)
    {
    uint_fast8_t i = 0;
    uint8_t ch = str[i++];

    while (ch != '\0')
    {
    app_uart_put(ch);
    ch = str[i++];
    }
    }

    for using printf() directly.

  • Hi Henry,

    Thanks. So basically any of the two circled ground locations would suffice?

    Thanks,

    Jinyue

  • Yes, enough....The hardware rule you may discuss with the hardware staff in your company. 

Related