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

  • Hello Mickael,

    I guess this could be related to the custom HW, the way its linked to your custom app, or the custom configurations you have going on there. Having a bare-metal application can make this a bit harder to support, considering that we mainly support NCS. Though I'll of course try to help you.

    Do you have access to DKs there as well which you can run this on? Have you had the HW reviewed by us before?

    Regards,

    Elfving

  • Good morning Elfving,

    Thank you for your response. I understand that the custom HW and bare-metal application makes it hard to support. This is for now just a proof-of-concept that I had previously managed to get it running with NCS, so now I am trying to only use the bare minimum (dm static library, cmsis and math.h). Since last week, I havent tinkered with it much more. Here are some of my thoughts and maybe you could clarify some points:

    - does the dm library assume I have the BT stack implemented / do I need to have the nrf softdevice flashed? (I assume it justs needs to control the radio peripheral)

    - as I do get remote rssi values (see screenshot), can I assume radio control is set up correctly? the rssi values change slightly for every few rangings.

    - dm_status always returns successful, according to the dm library, what condition must be satisfied to return success?

    - does the prebuilt dm library have some sort of debug logging incorporated that I could make use of?

    - is further configuration required? (I've incorporated all dependencies mentioned: cmsis, math.h)

    Yes I do have a few DKs lying around. I will try to build the application for the DK in the next few days and let you know if the same happens there. In the mean time, I would be grateful for any other tips you might have! Thank you!

    Best regards,

    Mickael

  • Hi Mickael, 
    Håkon is on vacation this week so I will take over in the mean time. 

    mkopp said:
    - does the dm library assume I have the BT stack implemented / do I need to have the nrf softdevice flashed? (I assume it justs needs to control the radio peripheral)

    As far as I know the dm library is independent from the RF protocol you use. So it doesn't require BT stack. You can find the info here:
    https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/libraries/others/dm.html

    I will need to get people with deeper knowledge on nrf_dm to help on your other questions. As mentioned by Håkon, we have limited support for using the library in bare metal. Please let us know the result when you test with the DKs. 

  • 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