Synchronisation between TX and RX in connectionless direction finding

We're trying to synchronise TX and RX in a connectionless direction finding setup. What we want to do is increment a data counter, log this on the TX timestamped, and send this as part of the periodic advertisement packet so that we can log it on the RX side and later provide the TX timestamp for data processing. We currently have `bt_le_ext_adv_start_param.num_events` set to 0 so that it just keeps sending periodic advertisement trains after initialising the Bluetooth and Direction Finding systems.

As far as I can tell, a counter is already incremented in the per_adv_counter, which is accessible from the `bt_df_per_adv_sync_iq_samples_report` whenever we receive a CTE. However, it seems like this is completely deferred to the subsystem and there is no way to access this in the TX application code. Is there e.g., an event we can listen to related to the sending of a CTE on the TX side? 

As an alternative, I've tried setting bt_le_ext_adv_start_param.num_events to 1 and doing something like this in the callback

static void adv_sent_cb(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_sent_info *info)
{
LOG_INF("Advertiser[%d] sent %d", bt_le_ext_adv_get_index(adv), info->num_sent);
data_counter++;

LOG_INF("Transmitting counter %d ", data_counter);

memcpy(mfg_data, &data_counter, sizeof(uint16_t));

const static struct bt_data ad_update[] = {
BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, 2),
};
bt_le_adv_update_data(ad_update, ARRAY_SIZE(ad_update), sd, ARRAY_SIZE(sd));
bt_le_ext_adv_start(adv_set, &ext_adv_start_param);
}

But checking the logging from the RX, this results in no CTEs being sent. 

Parents
  • Hi Glen

    Could it be that you have made too many changes too quickly, and now don't know where the issue exactly lies now. 

    Starting out with the working samples, I recommend that you do incremental updates on both TX and RX samples, then confirm the change you made works, before moving on to the next feature/implementation. For example. To get updated periodic advertising data, start testing with the periodic_adv and periodic_sync sample, then make changes to the connectionless TX/RX samples of Direction Finding and make sure that works before moving on.

    I'm not able to see an obvious issue with your sync function, and it's hard to pin point what exactly is going wrong here, so I think taking a step or two back would be the right approach here.

    Best regards,

    Simon

  • Hi, Simon

    I did try your suggestion, which allowed me to send updated data eventually. It was still quite finicky to merge it with the connectionless direction finding samples, but eventually I managed to get something working. Still don't know what was wrong, but this is resolved. May have a follow-up question to this, but will create a new post based on the new, working code

    Kind regards,

    Glen

Reply
  • Hi, Simon

    I did try your suggestion, which allowed me to send updated data eventually. It was still quite finicky to merge it with the connectionless direction finding samples, but eventually I managed to get something working. Still don't know what was wrong, but this is resolved. May have a follow-up question to this, but will create a new post based on the new, working code

    Kind regards,

    Glen

Children
No Data
Related