Notification for every successfull connection event of a BLE link

Hello,

I would like to trigger an action on every successfull connection event of a BLE connection.

Is there a way to know when the connection event was successful or at least when the RX part of the peripheral device was done?

I thought of using sd_ble_gap_conn_evt_trigger_start but then I saw this post and it says that the event is triggered before the radio event so it wont fit.   Connection event trigger and Timeslot API

Also the BLE radio notification does not provides a way to know what type of radio was done.

Thank you,

  • Hi Augustin

    Which nRF device are you planning to use? 

    Do you mind sharing what you are planning to use this feature for? 

    While the SoftDevice prevents access to radio registers while it is running, it does not prevent you from connecting radio events to other tasks through the PPI controller. 
    As such it is possible to trigger various activities based on what the radio is doing. 

    Most nRF52 devices have an event called RXREADY, which is fired every time the radio has been turned on in RX mode. This would then be followed by and END event (in case of a successful packet reception) and a DISABLED event, once the radio turned off again, so technically you could use these events to tell you when the radio has turned on the receiver to receive the first packet of a connection event (more detail on this here). 

    A couple of things to keep in mind though: 

    1) If you receive data you might receive several packets in a single connection event, so you have to find a way to only react on the first receive in the connection event. 

    2) The older devices in the nRF52 family, such as the nRF52832, does not have a separate RXREADY event but only a shared READY event for TX and RX. You might still be able to implement a working system, but you would get a more complex implementation. 

    3) There is no guarantee that the peripheral will receive the packet from the central on every event, or that a received packet will have a valid CRC. You could look for the CRCOK event to occur in between the RXREADY and DISABLED events, to signal that a valid packet was received. 

    Best regards
    Torbjørn

  • Hello,

    I am using the nrf52832

    I managed my way through using the PA/LNA gpiote, and I forked the ppi event used to toggle the pins to a custom task handler. I use the signal of the TX pin since in case of a connexion event the peripheral device sends the ack only after the successful RX part I think it works.

    If there is data to the transaction, I manage the process directly via the “normal” event of the softdevice

    Thank you for your answer, I am going to look a bit further in the options you proposed

    Best regards,

  • Hi Augustin

    Good to hear you found a solution that worked. The best of luck with your project Slight smile

    Best regards
    Torbjørn

Related