spoerk / contiki

BLEach: Exploiting the Full Potential of IPv6 over BLE in Constrained Embedded IoT Devices
Other
14 stars 12 forks source link

Can we disable ACK for connection oriented ble-command? #10

Open TayyabaZainab0807 opened 5 years ago

TayyabaZainab0807 commented 5 years ago

Regarding to the ble connection oriented code. I have noticed that if Master sends a packet and did not receive an ACK(no slave is available to listen) if does not sends the next packet because of if((channel->tx_buffer.sdu_length > 0) && (num_buffer > 0) && (credits > 0)) in ble-l2cap.c until a slave is available. As I am sending a time sensitive data, I want my Master to send the next packet even if there was no ACK for the last packet sent.

Is there any way to do this or the Master command in ble requires an ACK at any cost (i.e. is this a requirement for the command)?

spoerk commented 5 years ago

According to the BLE specification, every master packet needs to be acknowledged before another master packet can be sent. This is specified by the link layer acknowledgment and flow control mechanism of BLE.

In case that you do not need to be compliant to the BLE specification, you can in principle drop packets after some timeout in your BLE master implementation.

TayyabaZainab0807 commented 5 years ago

You mean to say (if I dont need to be compliant to the BLE specification), I should set the tx_buffers to DATA_ENTRY_FREE in connection_event_master(...)?

  for(i = 0; i < CONN_TX_BUFFERS_NUM; i++) {
      TX_ENTRY_STATUS(conn->tx_buffers[i]) = DATA_ENTRY_FREE;
      TX_ENTRY_LENGTH(conn->tx_buffers[i]) = 0;
      TX_ENTRY_NEXT_ENTRY(conn->tx_buffers[i]) = NULL;
  }

Can I not free all the buffers every time right after:

rf_ble_cmd_send(conn->cmd_buf);
 rf_ble_cmd_wait(conn->cmd_buf);

Do I have to wait for a timeout?

TayyabaZainab0807 commented 5 years ago

Spoerk, In ble_master() we are setting TX_ENTRY_STATUS(conn->tx_buffers[i]) = DATA_ENTRY_PENDING; but I dont see where we are setting the status to DATA_ENTRY_FINISHED;

spoerk commented 5 years ago

The data entry is set to DATA_ENTRY_FINISHED by the radio core (the Cortex M0 of the SensorTag) autonomously.