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

Dual ANT BLE transmission pattern

I'm trying to add BLE support to an existing ANT sensor. I intend to transmit information over ANT and BLE at the same time. In my current ANT implementation, I'm using the EVENT_TX reported by the softdevice event handler to trigger the next message in turn. In the reference examples for BLE sensors, the transmission is ruled by a timer that executes the tx task periodically.

Which one of those two different approach is correct? Which one should I choose when I implement both BLE and ANT in the same sensor? What happens if I use both? can they collide?

Thanks!

  • I'm assuming you are using an ANT master channel. As long as it is open and you are only using broadcast, it will send a message with fixed payload (8 bytes) every channel period. You can update the payload by using a timer, when you get the EVENT_TX event, on a button press or something else. It depends on how often you want to update it, and on your application. The updated payload will be included in the next channel timeslot. If you don't update it, the previous payload will still be included, so it will not reduce the size of the radio timeslot.

    You also have a BLE peripheral/slave. As long as you are in a connection (and slave latency is set to 0), it will send a packet to the master on every connection interval, but the payload is not fixed. It will only include a payload (up to 20 B) if you have something to send. You can say that you have something to send by using a timer, when you get the BLE_EVT_TX_COMPLETE, on a button press or something else. It depends on how often you want to send data, and on your application. The data will be sent on the next connection event. If you don't send anything, the data will not be included, so it will reduce the size of the radio timeslot.

    Note: With BLE you can actually send more than one packet in a connection interval, up to 6 packets with the S310 SoftDevice. Please see this, but this depends on the central device, see this.

    What I'm trying to say is that how you tell the SoftDevice that you have something to send doesn't really affect the collision rate, at least not for ANT, since the size of the radio timeslot is fixed. For BLE I would assume a larger radio timeslot will increase the chance of collision, but this depends more on other factors. For more information about this, please see Section 17 in the S310 SoftDevice specification v3.0.

  • Thanks for the thoughtful explanation. All is clearer now. I'd like to use the same approach for BLE and ANT, so I tried to listen to the BLE_EVT_TX_COMPLETE, but I never get that event in my ble_evt_dispatch function. Slave latency is set to 0, and other events like BLE_GAP_EVT_CONNECTED are received. Nevertheless, I've tried with a timer and it works. The tests I'm doing are using the CSC Service, cscs_measurement characteristic, no custom payloads.

  • You need to send something to get the BLE_EVT_TX_COMPLETE event. Are you sending something? So you would need to trigger the first sending somehow. The central has to enable CCCD before you can send notifications, maybe you can use the write event to CCCD to trigger the first notification. Let me know if you still struggle with this and I will look into it on Monday.

Related