Which is the best way of sending the data read from a sensor?

Hi,

I need to read the data from an acceleration sensor. I tried with a custom program of mine to simulate some data, but it is delaying too much.

I tried reducing the notification interval, but sometimes it just jumps numbers so to say, it should show 1,2,3. But now it shows 1,3,5.

Am I missing something?

Thank you!

  • Hi Karl,

    I am really sorry for the delay. I had to focus also on the reading of the sensor, the app for displaying the data and got stuck for a really long time. Now I had the chance to return and have a look at this issue again. 

    I see that now I am obtaining again .02 MB/s. I tried making 2 different threads, one that reads the values from the sensor ands stacks them in an array, and other one that sends the data. It is also not working.

    Having a look at the sniffer tool that you mentioned, I receive some things which I don't know if it is helpful to know, or how to interpret them. I see for example, that the updates in parameters to 2M and data length are being made. 

    But when I subscribe to the notifications, I see that the master is also taking quite some time to send something and it is empty, is this normal?

    Also, I don't see any warnings or errors.

    I attach some screenshots of the wireshark. If there is a better way to share the logs, please let me know.

    This first image is before any connection event

    This second image is when the connection happened

    This third image is before I subscribe

    This fourth image is during the subscription

    If there is any other information that might be useful, please let me know.

    Best regards, 

    Adrian Lopez

  • Now I figured out what to send, an apology.
    sniffer1.zip

    Best regards,

    Adrian Lopez

  • Hi Adrian,

    I will look into this and get back to you tomorrow.

    Br,

    Einar

  • Hi Adrian,

    From what I understand you want to maximize throughput. Generally, to maximize thourhput with BLE from a GATT server to a client this is important:

    1. 2 Mbps PHY
    2. Use data length extension to send as long link laye rpackets as possible
    3. Use along event length (equal to the connection interval).
    4. If using an event length equal to the connection inteval and the link has little packet loss, increasing the connection interval can then increase the thorughput due to overhead when changing connection interval.
    5. Make sure various buffers are large enough and always provide data to the stack so that it has data to send.

    Looking at the sniffer trace, 1 and 2 from the above list is good. The connection inteval is 15 ms which is perhaps a bit low. But at the same time, I also see that ther more data field is often not set, which is also a potential problem.

    So I suggest that you start with adjusting buffer sizes and event length as shown in the prj.conf from the throughput sample and perhaps also adjust the connection interval. Do you get better throhgput then? If not, make sure you attempt to send data fast enough.

  • Hi Einar,

    Thank you so much for your reply.

    Here, what do you mean?

    I also see that ther more data field is often not set, which is also a potential problem

    I adjusted the buffer sizes and also the event length.

    I tried changing the connection interval to 30ms, and it still does not work. Maybe the way I am setting my BLE connection is not right?

    For the prj:

    CONFIG_BT_USER_DATA_LEN_UPDATE=y
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    CONFIG_BT_BUF_ACL_RX_SIZE=502
    CONFIG_BT_BUF_ACL_TX_SIZE=502
    CONFIG_BT_L2CAP_TX_MTU=498
    
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    CONFIG_MAIN_STACK_SIZE=2048
    CONFIG_BT_RX_STACK_SIZE=2048

    And in the main, I see that in the sample you attaches, they are using bt_le_conn_param, I am using this, Should I change this?:

    static struct bt_le_adv_param *adv_param = BT_LE_ADV_PARAM(
    	(BT_LE_ADV_OPT_CONNECTABLE |
    	 BT_LE_ADV_OPT_USE_IDENTITY), /* Connectable advertising and use identity address */
    	BT_GAP_ADV_FAST_INT_MIN_2, /* 0x30 units, 48 units, 30ms */
    	BT_GAP_ADV_FAST_INT_MAX_2, /* 0x60 units, 96 units, 60ms */
    	NULL);
    	
    	

    I attach my code in case it is more useful.

    BLESPIZip.zip

    Thank you so much

    Adrian Lopez

Related