This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Send multiple notifications per connection interval

Hi, I'm developing a BLE application. I want to send multiple packets (from same characteristic) per connection interval.

I've read this question: devzone.nordicsemi.com/.../s110-sending-multiple-notifications-per-connection-event

Carles answered these questions clearly. But I still confused something I found by using ble_sniffer_0.9.5.

As the link says, we can use "BLE_EVT_TX_COMPLETE" to check the packet has sent out from slave. While I found more detail about sending large data. devzone.nordicsemi.com/.../dealing-large-data-packet-s-through-ble

I guess that method can support multiple notifications per connection interval.

And I found the sample code from this question: devzone.nordicsemi.com/.../send-data-to-client There is a lbs-throughput-test sample.

In 
 data_send()
 {
  [...]
  while(1)
  {
   [...]
   //Call function sd_ble_gatts_hvx(p_lbs->conn_handle, & params);
**ble_lbs_data_send(...)**
   [...]
  }
 }

In 
 on_ble_evt(ble_evt_t * p_ble_evt)
 {
  switch (p_ble_evt->header.evt_id)
  {
[b]   case BLE_EVT_TX_COMPLETE:
   data_send();[/b]
   [...]
  }
  [...]
 }

But above code only have one notification per connection interval. (see attatchment, 20ms per notification)

And I use ble_sniffer_0.9.5, I found something wierd... (See attechment)

1. Each connection interval has 4 packets while notification enabled
( In connection interval "A" )
master -> slave : 26 bytes empty packet
slave -> master : 52 bytes packet with data value "x"
master -> slave : 26 bytes empty packet
slave -> master : 52 bytes packet with data value "x + 1"
(but the MCP didn't show this..)

2. The next connection interval "A+1" (After about 18.8 ms)
master -> slave : 26 bytes empty packet
slave -> master : 52 bytes packet with data value "x + 1"
master -> slave : 26 bytes empty packet
slave -> master : 52 bytes packet with data value "x + 2"

I don't understand why the data value is repeated in the next connection interval. As my understanding, when BLE_EVT_TX_COMPLETE happens, the buffer in the softdevice can push more one packet by using sd_ble_gatts_hvx(...), And the data_send() function greedy calling sd_ble_gatts_hvx()...

Thus above method can support multiple notifications in one connection interval...

One possibility I guess is when "BLE_ERROR_NO_TX_BUFFERS" happens, The transmission in that connection interval is stopped. But it also cannot explain the data value repeated in the next connection interval.

Can anyone give me some suggestion? Thanks.

  • You should note that the current master emulator dongle will support only one packet per interval, so you can't really use this for throughput testing. The trace that's available in the GitHub repository was recorded with an iPhone 4S using iOS 7.0.

    However, as far as I can see, what actually happens in the trace you upload here is that the Master Emulator firmware NACKs every second packet, meaning that the peripheral retransmits it in the next interval. You can see this based on the fact that the NESN of the first packet in subsequent intervals is the same as the SN of the last packet of the previous interval, as shown in the attached screenshot.

    The concept of NESN and SN is described in the Core Specification, Volume 6, Part B, section 4.5.9, which among other things state:

    Upon receiving a Data Channel PDU, if the NESN bit of that Data Channel PDU is the same as transmitSeqNum, then the last sent Data Channel PDU has not been acknowledged and shall be resent.

    You can add any element from the packet detail view as a column by right-clicking it and selecting "Apply as column". NESN and SN are shown in the Bluetooth Low Energy part of the detail view.

    resending-packet.png

  • Thanks your information!! I've tried using HTC one max to receiving data. This code can support multiple notification!!

  • Hi Ole,

    as I can see I can't receive more than 1 packet per connection event using nRF51 dongle with Master Control Panel software. Can I receive more than 1 packet (for example 6 packets per connection event) using device with s120 software?

Related