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

NRF52840 TCP client and server implementation

Hi, 

I would like to set up a wireless communication channel between two NRF52840 DK boards. I checked the Nordic SDK v16.0 and found some examples such as \examples\iot\tcp and \examples\iot\udp. Both of these examples require thrd party device (Linux router device) to initialize the 6LoWPAN module. My question is, can I get some sample applications or sample ocdes that build the tcp/udp connection without the Linux router device? For example, one nRF board acts as server and can response for the connection request. Another board acts as client and can initialize the connection request. Thanks for your attention!

Best,

Zhonghao

Parents
  • Hello,

    If you are not interrested in the 3rd party devices, perhaps you can look into some of the examples from the ble_peripheral and ble_central folders in the SDK.

    If you want to send custom data between the devices, I suggest you study these two examples:

    SDK\examples\ble_peripheral\ble_app_uart
    SDK\examples\ble_central\ble_app_uart_c

    They can set up a link, and send messages back and forth.

    Check out the description of each example:

    ble_app_uart

    ble_app_uart_c

    Best regards,

    Edvin

  • Hello,

    Thanks for your response. We have checked the SDK\examples\ble_peripheral\ble_app_uart example and it works fine. We can send message from nRF connect to PUTTY, but not the other way as we cannot write the message in PUTTY.  We have some follow up questions: 1. Can we automate the messages that we send instead of manually input the message? 2. How to make the send and receive bi-directional? Thank you.

    Best,

    Zhonghao 

  • I suggest that you check out the UART terminal called "Termite" (for Windows). It is fairly easy, and you can send messages both ways. It is also possible to send messages in putty, if you set it up as described here:

    https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_cli.html&anchor=lib_cli_terminal_settings

    But using Termite is easier in my opinion.

     

    zhliao said:
    1. Can we automate the messages that we send instead of manually input the message? 2. How to make the send and receive bi-directional?

     Yes. If you have one device running ble_app_uart, and one running ble_app_uart_c they can send messages both ways. 

    on ble_app_uart use ble_nus_data_send() to send the message, and on ble_app_uart_c use ble_nus_c_string_send() to send the message.

    You can see from the examples that these are the functions used in the UART events to send the UART messages to the connected device.

    BR,

    Edvin

Reply Children
Related