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.