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

Sending Data Over BLE 5 Modules in Long Range with ble_app_uart

Hi,

I wanted to send data over Bluetooth 5.0 modules and to see on a terminal. So I used nRF52840 DK as central device ( ble_app_uart_c) and Fanstel modules ( ble_app_uart) as peripheral. I programmed them successfully and observed that nRF52840 DK paired with advertising Fanstel module (LED 1 is ON) . I see printed data on the terminal. Everything is fine so far. I've couple of questions. 

1. I know that long range advertisement is done by coded PHY (with nrf52840). Is it possible that I can send data in long range by using ble_app_uart ? Fanstel module I use supports BLE data rates: 2Mbps, 1Mbps, 500kbps,125kbps and I want to increase the range as possible as I can.

2. Can more than one advertising peripheral pair with the central device ?

3. In ble_app_uart, name of the advertising device is specified :

 

#define DEVICE_NAME                     "Nordic_UART"

I can't find related code line in ble_app_uart_c. How can I change the name of device central tries to connect to ?

4. I used RTT Viewer to see data because Putty didn't work I don't know why. Are there any other programs you could suggest for this operation ?

5. Is it enough to use NRF_LOG_INFO to print data ? I mean should I use a function ?. Also, I would like to know  the maximum data length I can send  with ble_app_uart example.

I will be very glad if you help me.

Thank you in advance.

Best Regards.

  • Okay, I understand now.  Sorry for the late answer :)
    Before I verify your answer, I would like to clear somethings up:

    - When should we use ble_nus_string_send instead of printf() function to monitor received data ?

    - ble_nus_c_string_send() is in  ble UART Central example. But I want to send data from peripheral to central. So I think  I should use ble_nus_data_send function in ble UART periphreal example, shouldn't I ? Let's say I write this in main() in ble_app_uart example :

    static uint8_t data_array[BLE_NUS_MAX_DATA_LEN] = "Hello World";
            uint16_t length = 11;
    
            ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle);

    After that, what should I do to see data on the central side ?

    Thank you in advance.

  • OpenCircuit said:
    When should we use ble_nus_string_send instead of printf() function to monitor received data ?

     Use ble_nus_string_send()  when you want to send data to a connected peer device and printf when you want to print something out on the UART interface.

    OpenCircuit said:
    ble_nus_c_string_send() is in  ble UART Central example. But I want to send data from peripheral to central. So I think  I should use ble_nus_data_send function in ble UART periphreal example, shouldn't I ? Let's say I write this in main() in ble_app_uart example :

     Yes, you can use the function to send data. Check the return value to see if the data is being sent or not.

    uint32_t err_code = ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle);

    NRF_LOG_INFO ("ble_nus_data_send returned 0x%x", err_code) // return value 0 is the same as NRF_SUCCESS

Related