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

Connecting UART Data to development board PCA10040

I am trying to transfer data from a USB to serial converter board (called board A) to the nrf5 board (called board B). I made the connection over a bread board, the transmitter from board A  is connected to pin 06 on board B, it is also at the same time connected to the receive in Board A. I am sending zeros and receiving zeros at board A. I want to see these zeros at board B.

The baud rate on both is adjusted to 19200. The ground is connected on both boards.

I started uart_pca10040 example but I don't get any data received on board B. I tried to connect pin 5 with 7 for CTS and DTR but also I don't see any data.

The data voltage on Board B is 2.1 V.

Parents Reply Children
  • I think you need to go back to the unmodified UART example in the SDK.

    Spend time with the debugger, a terminal, and an oscilloscope exploring that, and understanding how it works.

    Use the oscilloscope to observe the data between the nRF52 to the on-board USB-to-UART.

    Once you have this thoroughly understood, then - and only then - move on to modify that example to talk to a separate USB-to-UART converter.

    Once you have that working, then you can move on to getting 2 boards to talk to each other.

  • I made this. But when i change the pins, nothing is getting into action. I can not disable the on board usb to uart and input external serial data. It seems that the pins need to be changed in many places. I need help or a step by step to solve it. I am now 3 days on it.

  • i have been working with this issue now 1 week, and investigated many things, but i can not input data externally. I need  a step by step guide. Guys, if you made it previously, please assist me how to do it.  I changed the pin assignments for RX and TX but it does not make any change

  • Lets rephrase my question. I have the following simple code in the main, based on ble_app_uart. it initializes the uart and writes data to it. First i see UART started on the terminal. Second i want to see these bits. When i connect a led to pin 23 which i used for Tx, i don't see any thing.

        uint32_t                     err_code;
        app_uart_comm_params_t const comm_params =
        {
            .rx_pin_no    = RX_PIN_NUMBER,
            .tx_pin_no    = SER_CON_TX_PIN, //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,
    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UART_BAUDRATE_115200
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };


    int main(void) { uart_init(); printf("\r\nUART started.\r\n"); for (;;) { idle_state_handle(); uint32_t err_code = app_uart_put(255); if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY)) { NRF_LOG_ERROR("Failed receiving NUS message. Error 0x%x. ", err_code); APP_ERROR_CHECK(err_code); } else { NRF_LOG_ERROR("received data"); } } }
  • Solved:

    Here is the solution:

    1- Use pin 3 and 2 and disable the rts and cts

    static void uart_init(void)
    {
        uint32_t                     err_code;
        app_uart_comm_params_t const comm_params =
        {
            .rx_pin_no    = 3, //RX_PIN_NUMBER,
            .tx_pin_no    = 2,//TX_PIN_NUMBER,
    //        .rts_pin_no   = 17, //RTS_PIN_NUMBER,
    //        .cts_pin_no   = 18, //CTS_PIN_NUMBER,
            .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
            .use_parity   = false,
    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UART_BAUDRATE_115200
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };
    
        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);
    }
    

    2- don't connect any leds because it seems that drawing any amount of rel. current will disable the data transfer

    3- connect board A (serial to usb) to board B (PCA10040)

    Gnd-Gnx

    Rx (board A) - Pin 2 (Board B)

    Tx (board A) - Pin3 (Board B)

    4- Install the mac usbto serial port driver  (or use Serial app because it has internal drivers but cost 25$)

    My driver was based on this link

    https://blog.sengotta.net/signed-mac-os-driver-for-winchiphead-ch340-serial-bridge/

    5- Using cool Term connect to your usb-serial port

    6- using segger

    in my main loop i sent 1 and 255 for testing

        for (;;)
        {
            idle_state_handle();
                   uint32_t err_code = app_uart_put(1);
                    if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY))
                    {
                        NRF_LOG_ERROR("Failed receiving NUS message. Error 0x%x. ", err_code);
                        APP_ERROR_CHECK(err_code);
                    }
                    else
                    {
                         NRF_LOG_ERROR("received data");
                    }
                
        }

    7- if you connection is correct, you should see the 1 (byte sent) in cool term
Related