Nordic Distance Measurement library - dm_report not being populated

I have successfully managed to incorporate the hard-float build of the library for the nrf52840 into my bare-metal application (custom hardware with an nrf52840) and have been able to get successful rangings (dm_status=NRF_DM_STATUS_SUCCESS) between 2 nodes, one acting as a reflector and the other as an initiator. However the nrf_dm_report_t doesnt get populated except for some values. Every now and then a ranging is unsuccessful, but all successful ones show the same as below. As I cannot dig deeper into the nrf_dm implementation, I was wondering if you could provide me with some insight on what could be going on.

Here is the serial log with the contents of dm_report:

[DM][000000010] I: NRF DM library version: nrf_dm_0.7.5+
[DM][000000011] I: nrf_dm_config_t:
[DM][000000011] I: Role: 1
[DM][000000011] I: Ranging Mode: 1
[DM][000000011] I: RNG Seed: 4294967295
[DM][000000011] I: TX Power (dBm): 4
[DM][000000011] I: Antenna Composition: 0
[DM][000000014] I: I Tones Local: 0, 0, ..., 0
[DM][000000014] I: Q Tones Local: 0, 0, ..., 0
[DM][000000014] I: I Tones Remote: 0, 0, ..., 0
[DM][000000014] I: Q Tones Remote: 0, 0, ..., 0
[DM][000000019] I: SINR Indicators: 0
[DM][000000019] I: Ranging Mode: 1
[DM][000000019] I: Distance Estimates: IFFT: , Phase Slope: , RSSI Openspace: , Best:
[DM][000000025] I: Status: 0
[DM][000000025] I: Link Loss: 42
[DM][000000025] I: RSSI Local: 38
[DM][000000025] I: RSSI Remote: 38
[DM][000000025] I: TX Power Local: 4
[DM][000000025] I: TX Power Remote: 4
[DM][000000025] I: Quality: 0
[DM][000000025] I: RTT Accumulated (ns): 0
[DM][000000025] I: RTT Count: 0
[DM][000000031] I: nrf_status: 0

Here is the code excerpt:

dm_status = nrf_dm_proc_execute(timeout_us);
if (dm_status == NRF_DM_STATUS_SUCCESS)
{
    nrf_dm_populate_report(&dm_report);
    quality = nrf_dm_calc(&dm_report);
    duration = nrf_dm_get_duration_us(&dm_config);
    distance = nrf_dm_high_precision_calc(&dm_report);
    nrf_dm_get_hopping_sequence(&dm_config,hopping_seq);
    dm_print_report(&dm_report);
}

Thank you for your assistance, let me know if you need more details.

BR Mickael

Parents Reply Children
  • Hello, thank you for your reply.

    I finally was able to get back to the project this morning and tested it with 2 DKs: same result.

    After some further investigation I have found the culprit. A little embarrassing but the logging module I was using does not have an implementation for printing floats, hence the empty values in the first post. Converting the results before printing solved the issue. I wish I had thought of this earlier. It indeed has been working since the first try...

    Thank you for trying to solve a problem that didnt exist!

    Best regards,

    Mickael

Related