Channel Sounding example with swapped GAP roles

I am working with the connected_cs examples on the nRF54L15 DK and trying to swap the GAP roles.
In my case:

  • Initiator = GAP Peripheral

  • Reflector = GAP Central

However, when I attempt this setup, I cannot start CS Security on the Initiator.

Here is the console output:
*** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***
*** Using Zephyr OS v4.0.99-783b8ae1b7a9 ***
Starting Channel Sounding Demo (Initiator)
Connected to CE:16:77:E3:B5:9A (random) (err 0x00)
MTU exchange success (247)
Security changed to level 2.
CS capability exchange completed.
CS config creation complete. ID: 0
Failed to start CS Security (err -13)

I did not find any explicit dependency in the documentation that ties the CS Security procedure to the GAP Central role, so theoretically, this configuration should work.

Question:

  • Is there an internal limitation in the stack that prevents CS Security from starting when the Initiator is a GAP Peripheral?

  • If not, could you point me in the right direction to get this configuration working?


I have attached the modified examples
channel_sounding.zip

Parents
  • Hello,

    Again, I am terribly sorry for the late reply. I have had a long backlog of channel sounding questions, so I am trying to go through them all.

    I finally got it working, with some help from our R&D. 

    I started with the samples found in NCS v3.1.0\nrf\samples\bluetooth\channel_sounding_ras_initiator/reflector, and came to the same conclusion that you did, but then I figured that it is the central (now reflector) that needs to deal with the security, and it is the initiator that needs to call bt_le_cs_set_procedure_parameters() and bt_le_cs_procedure_enable(). 

    This lead up to this:

    channel_sounding_swapped_roles.zip

    I am sorry, it is a bit messy, with parts of the code still commented out, but it should be working.

    Give it a go, and let me know if it doesn't work on your end.

    Best regards,

    Edvin

  • Hello Edvin,

    Thank you for getting back to me, and no worries about the delay!

    Your example works perfectly on the latest toolchain (v3.1.0). With your advice, I also managed to modify the examples I was working on. I'm attaching my updated samples - maybe they will be useful for someone else as well.

    Thanks again for your help - this really unblocked me.

    Best regards,
    Oleksandr

    0066.channel_sounding.zip

Reply Children
  • Thank you for sharing! Especially these days, when channel sounding is still fairly new, it is useful to have some samples like this, showing how to swap the roles. In fact, swapping roles like this can be useful if you want to measure the distance between one moving target and several stationary. You would want the moving target to be the central device, because it needs to handle several connections. But you want to offload the majority of the work to the stationary devices, because they are only doing measurements for one device each, so it makes sense to make their CPU handle the heavy mathematics. 

    Best regards,

    Edvin

Related