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

Multilink + NUS data reception problem

Hi everyone,

I'm working on a project where I need to send sensor data from multiple sources to a PC. So, I'm using multiple SparkFun Pro nRF52840 Mini board (Peripherals) to acquire data from the sensor and send them over BLE. I have a nRF52840 Dongle (Central) who receive the data from the SparkFun boards and send them on serial usb to a computer.
SparkFun boards send data every 1 ms.

The problem is when I receive data on the computer, it's like 10 data set from one board, then 10 data set from another etc.
This is what it looks like when I receive the data from 3 peripheral boards and then send them over serial USB with the Dongle :

I'd like to receive 1 data set from each board everytime. But I don't really know what I need to change for that to happen.

The Dongle is programed with the ble_app_uart_c example + USB CDC ACM and multilink functions.
The SparkFun Pro nRF52840 boards are programed with thr ble_app_uart example + SAADC functions.

Thanks for your help in advance,

Jean

Parents
  • Hi,

    I am not sure what you use case is, hence I am not sure if my proposals are valid or suited for you.

    Can you try to send your data not this often, e.g. every 100ms and see if this solves your issue?
    Otherwise you can print your data only when you have at least one data set from each peripheral device, e.g. using only the latest data.

    Another item, printing every packet you receive will en up in a massive amount printing when you are receiving 3 packets each ms.

    I am wondering about how are you printing.
    It could look like you are printing all of the data you have available for a giving peripheral device, before checking if there are available data for another device instead of only printing when you receive a new data set. 

    BR,
    Håkon

  • Hi,

    Thanks for your answer! If I try to send data every 100ms, it works, I only receive one data set from each peripheral at a time. But I need to send the data faster.

    I'm printing the data with the Dongle using the app_usbd_cdc_acm_write() function when the BLE_NUS_C_EVT_NUS_TX_EVT is called.

    "Otherwise you can print your data only when you have at least one data set from each peripheral device, e.g. using only the latest data."
    Do you have an idea on how I can implement that in my program?

    "It could look like you are printing all of the data you have available for a giving peripheral device"
    Yes, maybe that's what is happening!

    Thanks,

    Jean

Reply
  • Hi,

    Thanks for your answer! If I try to send data every 100ms, it works, I only receive one data set from each peripheral at a time. But I need to send the data faster.

    I'm printing the data with the Dongle using the app_usbd_cdc_acm_write() function when the BLE_NUS_C_EVT_NUS_TX_EVT is called.

    "Otherwise you can print your data only when you have at least one data set from each peripheral device, e.g. using only the latest data."
    Do you have an idea on how I can implement that in my program?

    "It could look like you are printing all of the data you have available for a giving peripheral device"
    Yes, maybe that's what is happening!

    Thanks,

    Jean

Children
  • Hi,

    Good, it works OK when transmitting more seldom.

    I am not sure how you do things in your code.
    However, a few things worth mentioning after discussing with my colleagues.

    The minimum connection interval in BLE is 7.5 ms, per link.

    It is possible to to decide how must time is set aside for each link on each connection interval
    NRF_SDH_BLE_GAP_EVENT_LENGTH - The time set aside for this connection on every connection interval in 1.25 ms units.

    It is possible to use the Enhanced Shockburst protocol in applications where shorted connection intervals are needed.

  • Thanks! I tried to reduce the connection interval to the minimum (7.5 ms) and NRF_SDH_BLE_GAP_EVENT_LENGTH to 1.25 ms but it's still not fast enough.

    I'm going to see if I can find something else, but I think that I'm at the limit here... 

Related