Reset the channel sounding parameters after a disconnection

Hi, I am trying to sound two reflectors from a single initiator, and since the CS works on a one-to-one ACL system, I wanted to know how I can reset the CS-related stuff in the code. I did try this without reboot, the data becomes stagnant after a reconnection or when I connect 2 reflectors (not sound, but just connect)  

The sample provided by Nordic does a soft reboot, so it works flawlessly. I am trying to take a different path of not connecting to both of my nodes at once and do a soft reboot every time I wanna switch the sounding, but I wanted to know if a manual reset was possible for the CS params and buffer, so that I can continue with sounding another device without doing a soft reboot.

Parents
  • Hello,

    This should be possible. You mention that you want one initiator and two reflectors. This will probably work, but if you are planning to have many reflectors, you may want to switch it around. You see, the main CPU usage is in the initiator, and the reflector is not doing any heavy lifting. This means that if you plan to have many stationary devices and one moving device, it may make sense to have the stationary devices being the initiators, all doing channel sounding towards the same reflector. This means that the moving device (reflector) can last longer on a smaller battery.

    without reboot, the data becomes stagnant after a reconnection

    What does it mean? do you get any channel sounding data from the second connection, or none at all?

    Best regards,

    Edvin

Reply
  • Hello,

    This should be possible. You mention that you want one initiator and two reflectors. This will probably work, but if you are planning to have many reflectors, you may want to switch it around. You see, the main CPU usage is in the initiator, and the reflector is not doing any heavy lifting. This means that if you plan to have many stationary devices and one moving device, it may make sense to have the stationary devices being the initiators, all doing channel sounding towards the same reflector. This means that the moving device (reflector) can last longer on a smaller battery.

    without reboot, the data becomes stagnant after a reconnection

    What does it mean? do you get any channel sounding data from the second connection, or none at all?

    Best regards,

    Edvin

Children
  • The data just come from the same step data which was saved into the buffer when it got disconnected or in another scenario when it gets connected with another reflector. I have a small log to show this, as soon as I connect the 2nd device it happens to stagnate the value.


    I: Scan started
    I: Filters matched. Address: F9:B1:53:59:F9:F5 (random) connectable: 1
    New Device F9:B1:53:59:F9:F5 (random) connected, total connected: 1
    I: Scan started
    I: Pairing completed: F9:B1:53:59:F9:F5 (random), bonded: 0
    I: Security changed: F9:B1:53:59:F9:F5 (random) level 2
    I: MTU exchange success (498)
    I: Service discovery completed for NUS
    I: Service discovery completed for RAS
    I: Read RAS feature bits: 0x1
    I: CS capability exchange completed.
    I: CS config creation complete. ID: 0
    I: CS security enabled.
    I: CS procedures enabled:
    - config ID: 0
    - antenna configuration index: 0
    - TX power: 0 dbm
    - subevent length: 28198 us
    - subevents per event: 1
    - subevent interval: 0
    - event interval: 2
    - procedure interval: 5
    - procedure count: 0
    - maximum procedure length: 1000

    I: 2.634895,4.304833,5.259593
    I: 2.634895,4.304833,5.259593
    I: 3.869948,4.385984,5.259593
    E: empty step data
    I: 3.869948,4.385984,5.259593
    I: 3.869948,4.385984,5.259593
    Data from Reflector 2
    I: 3.869948,4.385984,5.259593

    I: Filters matched. Address: F3:75:57:CA:A5:3A (random) connectable: 1
    I: 3.869948,4.385984,5.259593
    New Device F3:75:57:CA:A5:3A (random) connected, total connected: 2
    I: Scan started

    I: 4.008082,4.385984,5.201116
    E: empty step data
    I: 4.008082,4.385984,5.201116
    I: 4.008082,4.385984,5.201116
    I: 4.008082,4.385984,5.201116
    E: empty step data
    I: 4.008082,4.385984,5.201116
    I: 4.008082,4.385984,5.201116
    E: empty step data
    I: 4.008082,4.385984,5.201116
    I: 4.008082,4.385984,5.201116
    I: 4.008082,4.385984,5.201116
    E: empty step data
    I: 4.008082,4.385984,5.201116
    I: 4.008082,4.385984,5.201116
    E: empty step data

    I did try to do the bt_le_cs_procedure_enable(), with parameters as .enable to be set to 0. But it didn’t work. Is there a way to reset this? Like an API function call??

  • // Disable CS procedures
    struct bt_le_cs_procedure_enable_param params = {
    .config_id = CS_CONFIG_ID,
    .enable = 0,
    };
    err = bt_le_cs_procedure_enable(conn, &params);
    if (err) {
    LOG_WRN("Failed to disable CS procedures (err %d)", err);
    }


    The above function yields me the following log with error as EIO 5 /* I/O error */


    Disconnected: F3:75:57:CA:A5:3A (random), reason 0x08
    W: opcode 0x2094 status 0x02
    W: Failed to disable CS procedures (err -5)

  • I have found my answer and also a mistake.

    bt_le_cs_procedure_enable() was returning an error because the connection would already be stale after the disconnection. Hence, I tried to run it just by resetting the buffers, but I soon faced this issue of 

    W: Could not locate mandatory
    On-demand ranging data characteristic E: RAS RREQ alloc init failed (err -22)
    Then I started looking into my device discovery and found a problem there. I use NUS and RAS as well, so I chained their discoveries. And I was not resetting some states to do this properly.
     
    Now I need to work on the multiple connections part. This whole RAS and NUS were running on the multilink_central code, so do you have any suggestions on the multiple connections and the sounding part?
  • How many initiators and reflectors do you intend to have? And is the moving device the smaller device?

    Vinayaka KS said:
    do you have any suggestions on the multiple connections and the sounding part?

    Not other than doing the same thing that you were already doing on one connection.

    But again, you may want to consider having two initiators that are peripherals, and one central that is the reflector.

    BR,

    Edvin

  • Hi Edvin,
    I am actually doing my master's thesis on the implementation of this, so for the current scenario considered, it's going to be 2 moving devices with 1 stationary device.
    So I am using 1 central initiator (stationary) with 2 peripheral reflectors (moving). Does this make sense in terms of power consumption footprint?
    I implemented the part where I am currently sounding to 2 devices consecutively. At any given point in time, there is only 1 peripheral reflector connected to the central initiator. The problem arises as the switching (disconnection, connection, and CS parameters exchange) takes around 4-5 seconds. Is there any way I can get a better response time?
    I am looking into 2 directions of solutions for this:

    1) Find a way to make the CS params exchange faster (maybe store the params in flash)  - This reduces the time for CS param exchange

    2) Stay connected to 2 devices, but sound only to one device - This reduces the time taken for connection and disconnection

    Can I get some insights about these probable solution methods? I would also be glad to know if you have some other solution in mind.

    Thanks,
    Vinayaka KS

Related