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

Sending data continuously via NUS with the ble_app_uart example

Hi all,

in my project I have a nRF52DK and a nRF52840DK. I will use the nRF52DK as peripheral and the nRF52840DK as central. For this I flashed ble_app_uart on to the peripheral and ble_app_uart_c on the central. This works like a charm :) . I am very happy with these examples.

For my project I want to send some data continuously from the peripheral to the central. So I need a continuous data transfer from the peripheral to the central. I need to achieve a data rate of ~50 kBit/s (~6,25 kByte/s). To achieve this data rate, I want to send for example 200 Bytes every 32 ms. The ble_app_uart example seems like a great starting point for this. In the ble_app_uart example the send function (ble_nus_data_send()) gets called by "enter" as input. So maybe I need to call this function in a loop or with a timer. But I am not quite sure how to implement this correct.

I am familiar with the basics of BLE (Connection Interval, MTU, DLE,..) and have a few experience with the programming of microcontrollers, but I am pretty new to the nRF environment.

So I want to ask you kindly, if you can give me some proper guidance on how to modify the ble_app_uart example to get this continuous data transfer via NUS?

I am looking forward to hearing from you. Thank you so much in advance.

Kind regards,

Maria

  • Hello Vidar Berg,

    I had to add the following to the ble_stack_init:

        err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &ble_cfg, ram_start);
        if (err_code != NRF_SUCCESS)
        {
            NRF_LOG_ERROR("sd_ble_cfg_set() returned %s when attempting to set BLE_CONN_CFG_GATTS.",
                          nrf_strerror_get(err_code));
        }

    It looks like the queue size was not applied before. I have to do further testing, but I it looks promising at the moment. It seems that it works now.

    Thank you very much.

    Kind regards,

    Maria

Related