Nordic Distance Measurement , precision vs Webinar?

Hi Nordic :)

I followed last week the nice Webinar on topics : Nordic Distance Measurement library

I'm using two nrf52833 DK, and run on both nrf_dm sample zephyr project.

I have to admit that i was really enthousiast by the results of the high precision method.

But i have to admit that by running the example i can't achieve same result than you.

Both stability and precision in direct path indoor environnement are not really what i expect.

By waiting that i develop a small tool to log my results and share with you real data,

1) is there an option in the example code  nrf_dm that i could change to put at maximum the precision even if it cost time ans flash size.

I only found in peer.c:    #define DEFAULT_RANGING_MODE    DM_RANGING_MODE_MCPD        that should be better than RTT on short range.

2) Durring webinar you talked about nrf_dm_high_precision_calc that i couldn't find in the code,  only in API documentation. Is it possible to quickly adapt nrf_dm demo to use it ?

I'm interrested in measuring distance from 50cm to 10m and both product can be in bag for exemple.
I still hope i could reach the precision and stabilty with this technic ! 
Thanks a lot !
Parents
  • I tried to replace in dm.c nrf_dm_calc by nrf_dm_high_precision_calc() but it seems more complexe than that because i get a linking error:

    undefined reference to `arm_mat_cmplx_mult_f32'

    [391/408] Building C object zephyr/kernel/CMakeFiles/kernel.dir/xip.c.obj
    [392/408] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mempool.c.obj
    [393/408] Building C object zephyr/kernel/CMakeFiles/kernel.dir/work.c.obj
    [394/408] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timer.c.obj
    [395/408] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timeout.c.obj
    [396/408] Building C object zephyr/kernel/CMakeFiles/kernel.dir/poll.c.obj
    [397/408] Linking C static library zephyr\kernel\libkernel.a
    [398/408] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    cmd.exe /C "cd . && C:\nordic\v1.9.1\toolchain\opt\bin\arm-none-eabi-gcc.exe   @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf  && cmd.exe /C "cd /D C:\nordic\appflo\nrf_dm\build_1\zephyr && C:\nordic\v1.9.1\toolchain\opt\bin\cmake.exe -E echo ""
    c:/nordic/v1.9.1/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: C:/nordic/v1.9.1/nrfxlib/nrf_dm/lib/nRF52833/hard-float/libnrf_dm.a(libnrf_dm.obj): in function `sym_100493':
    (.text+0x94): undefined reference to `arm_mat_cmplx_mult_f32'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'c:\nordic\v1.9.1\toolchain\opt\bin\cmake.EXE' --build 'c:\nordic\appflo\nrf_dm\build_1'
    The terminal process terminated with exit code: 1.
    
    Terminal will be reused by tasks, press any key to close it.

    After searching this function in the sdk i can see it is declared in arm_math.h and also used compiled in libnrf_dm.a librairies.

    I had two lines to my project files:

    CONFIG_CMSIS_DSP=y
    CONFIG_CMSIS_DSP_MATRIX=y
    And it build. I flash my board with this software but i get an error: ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0 coming from dm_thread apparently. 
    It seems i need to give more memory (try 4096) to this thread that use 2048bytes ( CONFIG_MAIN_STACK_SIZE )

    *** Booting Zephyr OS build v2.7.99-ncs1-1  ***
    <LF>Starting Distance Measurement example
    <LF>I: SoftDevice Controller build revision: 
    <LF>I: 0e e7 c5 66 67 18 3c ac |...fg.<.
    <LF>I: b3 d2 cc 81 a3 dc f1 c0 |........
    <LF>I: c0 36 02 22             |.6."    
    <LF>I: HW Platform: Nordic Semiconductor (0x0002)
    <LF>I: HW Variant: nRF52x (0x0002)
    <LF>I: Firmware: Standard Bluetooth controller (0x00) Version 14.50663 Build 1008232294
    <LF>I: Identity: C1:55:9C:F4:51:DD (random)
    <LF>I: HCI: version 5.2 (0x0b) revision 0x12fe, manufacturer 0x0059
    <LF>I: LMP: version 5.2 (0x0b) subver 0x12fe
    <LF>DM Bluetooth LE Synchronization initialization
    <LF>E: ***** MPU FAULT *****
    <LF>E:   Stacking error (context area might be not valid)
    <LF>E:   Data Access Violation
    <LF>E:   MMFAR Address: 0x200086fc
    <LF>E: r0/a1:  0x00000140  r1/a2:  0x00000000  r2/a3:  0x00000000
    <LF>E: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x00000000
    <LF>E:  xpsr:  0x00000000
    <LF>E: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
    <LF>E: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
    <LF>E: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
    <LF>E: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
    <LF>E: fpscr:  0x00000000
    <LF>E: Faulting instruction address (r15/pc): 0x00000000
    <LF>E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
    <LF>E: Current thread: 0x20005950 (dm_thread_id)
    <LF>E: Resetting system
    

    It runs without errors. After modifying a bit the code , i'm able to print in the console the distance. So in exact position, without averaging:

    one Outlyer to 26m, average 3.46m without the outlyer.

    The measurement seems also to be much more robust when i place my body in between.

    I have to do now other measurements with distance and angle of the antenna  and obstacle variation.

    Hop this work will benefit to people that would like to try.

    If you have also suggestion concerning code modification to be sure i didn't miss something :) , and i'm really curious to have your advices concerning custom board using module that integrate their own antenna.

    Thank a lot 

  • Hi, 

      great solution to the problem. I followed your solution to implement the very same, but i am quite stuck at the point where nothing gets printed to the console. The program compiles fine and is also flashed onto the micro controller without any errors. can you explain how you got the result to be displayed on the console?

Reply Children
No Data
Related