Hello Team
I'm working sample nrf_dm project for distance measurement,
Beacon : nrf52833 Reflector
Anchor : nrf52840 Initiator
SDK: v3.1.1
Toolchain: v3.1.1
To avoid Anchor to Anchor and Beacon to Beacon distance measurement.
Modified the function code to work accordingly in
main.c
#define DM_ROLE DM_ROLE_INITIATOR /* For Beacon we are using DM_ROLE_REFLECTOR */
struct adv_mfg_data
{
uint16_t company_code; /* Company Identifier Code. */
uint32_t support_dm_code; /* To identify the device that supports distance measurement. */
uint8_t role; /* Device role: Initiator or Reflector. */
uint32_t rng_seed; /* Random seed used for generating hopping patterns. */
} __packed;static void scan_filter_match(struct bt_scan_device_info *device_info,
struct bt_scan_filter_match *filter_match,
bool connectable)
{
bt_addr_le_t addr;
bt_addr_le_copy(&addr, device_info->recv_info->addr);
// peer_supported_add(device_info->recv_info->addr);
bt_data_parse(device_info->adv_data, data_cb, &addr);
}static bool data_cb(struct bt_data *data, void *user_data)
{
...
switch (data->type)
{
case BT_DATA_MANUFACTURER_DATA:
...
if (recv_mfg_data->role == DM_ROLE) {
return false;
}
peer_supported_add(addr);
req.role = DM_ROLE;
req.ranging_mode = peer_ranging_mode_get();
...
}
static void adv_scanned_cb(struct bt_le_ext_adv *adv,
struct bt_le_ext_adv_scanned_info *info)
{
...
req.role = DM_ROLE;
req.ranging_mode = peer_ranging_mode_get();
...
dm_request_add(&req);
adv_update_data();
}static int bt_sync_init(void)
{
...
mfg_data.role = DM_ROLE_INITIATOR;
...
}Scan Parameters using:
static struct bt_le_scan_param scan_param = {
.type = BT_LE_SCAN_TYPE_ACTIVE,
.interval = BT_GAP_SCAN_FAST_INTERVAL,
.window = BT_GAP_SCAN_FAST_WINDOW,
.options = BT_LE_SCAN_OPT_FILTER_DUPLICATE,
.timeout = 0,
};prj.conf
CONFIG_BT=y CONFIG_BT_CENTRAL=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_SCAN=y CONFIG_BT_SCAN_FILTER_ENABLE=y CONFIG_BT_SCAN_NAME_CNT=1 CONFIG_BT_SCAN_MANUFACTURER_DATA_CNT=1 CONFIG_BT_SCAN_WITH_IDENTITY=y CONFIG_BT_ID_MAX=1 CONFIG_BT_EXT_ADV=y CONFIG_BT_DEVICE_NAME="Sytrak_Anchor" CONFIG_BT_DDFS=y # Distance Measurement CONFIG_DM_MODULE=y CONFIG_MPSL=y CONFIG_MPSL_TIMESLOT_SESSION_COUNT=1 CONFIG_DM_MODULE_LOG_LEVEL_DBG=n CONFIG_DM_GPIO_DEBUG=y CONFIG_PWM=y CONFIG_NCS_SAMPLES_DEFAULTS=y CONFIG_DK_LIBRARY=y CONFIG_DM_HIGH_PRECISION_CALC=y CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y CONFIG_DM_TIMESLOT_QUEUE_LENGTH=100 CONFIG_DM_TIMESLOT_RESCHEDULE=n
I’m testing a setup with 3 Beacons and 4 Anchors.
The issue I’m facing is that each anchor seems to be prioritizing a single beacon. For example:
Anchor 1 -> Beacon 1
Anchor 2 -> Beacon 2
etc.,
Each anchor is continuously getting distance measurements from only one beacon, and not receiving any distance data from the other beacons.
After some time, the system might switch to another beacon, but again it keeps measuring only for that beacon continuously.
I want to get distance measurements from multiple beacons across all anchors, either simultaneously or in a proper sequence, but currently it looks like each anchor is locked to one beacon.
Could you please help me understand what might be wrong in my configuration or setup?
Any suggestions on how to enable proper multi-beacon, multi-anchor ranging would be very helpful.