I tried running the official ranging example with nrf5340dk.
Bluetooth: nRF Distance Measurement with Bluetooth LE discovery
This example can obtain distance test results, but I want to use nrf5340dk to extract raw IQ data and use MCPD algorithm for distance measurement.I found the location of the IQ data in nrf_dm. h and added this header file to the main function.However, in order to obtain IQ data, it is necessary to run the function "void nrf_dm_populate_deport (nrf_dm_deport_t * p-neport)" in nrf_dm. h, and load the IQ data into the p-neport variable through this function. But this function is implemented in the precompiled library libnrf_dm. a. I cannot recognize it in the main function, so I cannot run it. I tried to link libnrf_dm. a to the project, but failed.I want to know how to extract the raw IQ data required for MCPD algorithm ranging using nrf5340dk. Or is it not supported in this project for users to extract IQ data for algorithm development?
The void nrf_dm_populate_deport (nrf_dm_deport_t * p-neport) function is declared in nrf_dm. h. The input of this function is a pointer variable, which is used to fill in report data, such as IQ data. After processing, it contains IQ data information that can be printed directly. However, the problem is that this function is precompiled. What I mean is, can this function be called?
I hope someone can answer my question. Thank you for your help!
If I don't run the function nrf_dm_populate_deport(), I can still print out the IQ data, but the resulting data looks incorrect. I guess it's some random numbers, not the correct IQ data.
static void data_ready(struct dm_result *result) { if (result->status) { peer_update(result); printk("Measurement successful:\n"); printk("Distance estimates (in meters):\n"); printk(" MCPD IFFT: %f\n", result->dist_estimates.mcpd.ifft); printk(" Phase slope: %f\n", result->dist_estimates.mcpd.phase_slope); printk(" Best estimate: %f\n", result->dist_estimates.mcpd.best); nrf_dm_report_t report; //nrf_dm_populate_report(&report); printk("IQ Data:\n"); for (int i = 0; i < 80; i++) { printk("Tone %d: Local_I=%f, Local_Q=%f, Remote_I=%f, " "Remote_Q=%f,SNR_L=%d,SNR_R=%d\n", i, report.iq_tones[0].i_local[i], report.iq_tones[0].q_local[i], report.iq_tones[0].i_remote[i], report.iq_tones[0].q_remote[i], report.tone_sinr_indicators .sinr_indicator_local[i], report.tone_sinr_indicators.sinr_indicator_remote[i]); } } }
Measurement result: Addr: DF:51:35:BB:2D:FC (random) Quality: ok Distance estimates: mcpd: high_precision=1.21 ifft=1.17 phase_slope=1.19 rssi_openspace=0.71 best=1.17 Measurement successful: Distance estimates (in meters): MCPD IFFT: 1.187876 Phase slope: 1.202429 Best estimate: 1.187876 IQ Data: Tone 0: Local_I=-0.089968, Local_Q=0.000000, Remote_I=-0.455842, Remote_Q=0.000192,SNR_L=92,SNR_R=1 Tone 1: Local_I=0.132814, Local_Q=0.000000, Remote_I=5265613015562278000000000000000000000.000000, Remote_Q=0.000000,SNR_L=175,SNR_R=7 Tone 2: Local_I=-0.093054, Local_Q=0.000000, Remote_I=7.187771, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 3: Local_I=0.130142, Local_Q=0.000000, Remote_I=1.000000, Remote_Q=0.000000,SNR_L=32,SNR_R=0 Tone 4: Local_I=-0.096067, Local_Q=0.000000, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=32,SNR_R=1 Tone 5: Local_I=0.127352, Local_Q=0.000000, Remote_I=0.543486, Remote_Q=0.000000,SNR_L=1,SNR_R=0 Tone 6: Local_I=-0.098986, Local_Q=0.000000, Remote_I=-0.018619, Remote_Q=2.163270,SNR_L=2,SNR_R=0 Tone 7: Local_I=0.124524, Local_Q=1.272156, Remote_I=-0.503413, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 8: Local_I=-0.101739, Local_Q=0.026976, Remote_I=0.028357, Remote_Q=0.000000,SNR_L=177,SNR_R=80 Tone 9: Local_I=0.121717, Local_Q=1.184149, Remote_I=0.164287, Remote_Q=0.000000,SNR_L=16,SNR_R=0 Tone 10: Local_I=-0.104336, Local_Q=0.088829, Remote_I=-0.011705, Remote_Q=3.306156,SNR_L=0,SNR_R=0 Tone 11: Local_I=0.118832, Local_Q=1.072954, Remote_I=0.202450, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 12: Local_I=-0.106863, Local_Q=-0.183026, Remote_I=-0.034410, Remote_Q=1000000.000000,SNR_L=1,SNR_R=152 Tone 13: Local_I=0.115845, Local_Q=1.009490, Remote_I=0.114079, Remote_Q=0.000000,SNR_L=0,SNR_R=32 Tone 14: Local_I=-0.109312, Local_Q=-0.020555, Remote_I=-0.009907, Remote_Q=0.000000,SNR_L=0,SNR_R=1 Tone 15: Local_I=0.112975, Local_Q=1.117781, Remote_I=-0.108140, Remote_Q=0.000000,SNR_L=0,SNR_R=32 Tone 16: Local_I=-0.111519, Local_Q=0.046442, Remote_I=-0.012253, Remote_Q=0.000000,SNR_L=0,SNR_R=37 Tone 17: Local_I=0.000000, Local_Q=1.032559, Remote_I=-0.045040, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 18: Local_I=0.000000, Local_Q=-0.062577, Remote_I=-0.150004, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 19: Local_I=0.000000, Local_Q=1.047898, Remote_I=-0.134742, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 20: Local_I=0.000000, Local_Q=0.087338, Remote_I=0.169879, Remote_Q=0.000000,SNR_L=0,SNR_R=16 Tone 21: Local_I=0.000000, Local_Q=1.170888, Remote_I=-0.028677, Remote_Q=0.000000,SNR_L=0,SNR_R=1 Tone 22: Local_I=0.000000, Local_Q=0.166905, Remote_I=0.010299, Remote_Q=0.000000,SNR_L=0,SNR_R=2 Tone 23: Local_I=0.000000, Local_Q=1.050962, Remote_I=-0.022799, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 24: Local_I=0.000000, Local_Q=0.056164, Remote_I=-0.002424, Remote_Q=0.000000,SNR_L=101,SNR_R=1 Tone 25: Local_I=0.098295, Local_Q=1.041417, Remote_I=0.011305, Remote_Q=0.000000,SNR_L=192,SNR_R=8 Tone 26: Local_I=-0.121284, Local_Q=-0.061093, Remote_I=0.008131, Remote_Q=0.000000,SNR_L=155,SNR_R=187 Tone 27: Local_I=0.095199, Local_Q=1.159505, Remote_I=-0.011921, Remote_Q=0.000000,SNR_L=63,SNR_R=73 Tone 28: Local_I=-0.122982, Local_Q=-0.114088, Remote_I=0.008128, Remote_Q=0.000000,SNR_L=32,SNR_R=1 Tone 29: Local_I=0.091957, Local_Q=1.036932, Remote_I=0.010171, Remote_Q=0.000000,SNR_L=1,SNR_R=0 Tone 30: Local_I=-0.124618, Local_Q=-0.110135, Remote_I=-0.014898, Remote_Q=0.000000,SNR_L=2,SNR_R=0 Tone 31: Local_I=0.088802, Local_Q=1.043403, Remote_I=0.026255, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 32: Local_I=-0.126077, Local_Q=-0.017022, Remote_I=-0.000377, Remote_Q=0.000000,SNR_L=1,SNR_R=1 Tone 33: Local_I=0.082940, Local_Q=1.342284, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=26,SNR_R=0 Tone 34: Local_I=-0.124119, Local_Q=0.025243, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=2,SNR_R=0 Tone 35: Local_I=0.000000, Local_Q=1.077483, Remote_I=0.785398, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 36: Local_I=0.000000, Local_Q=-0.149667, Remote_I=0.276117, Remote_Q=0.025502,SNR_L=1,SNR_R=144 Tone 37: Local_I=0.000000, Local_Q=1.086957, Remote_I=0.000000, Remote_Q=0.043064,SNR_L=0,SNR_R=32 Tone 38: Local_I=0.000000, Local_Q=0.026214, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=1 Tone 39: Local_I=0.000000, Local_Q=1.047064, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=32 Tone 40: Local_I=0.000000, Local_Q=0.140551, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=80,SNR_R=48 Tone 41: Local_I=0.000000, Local_Q=1.047586, Remote_I=-0.004786, Remote_Q=0.000000,SNR_L=0,SNR_R=1 Tone 42: Local_I=0.000000, Local_Q=0.018928, Remote_I=-0.020180, Remote_Q=0.000000,SNR_L=0,SNR_R=2 Tone 43: Local_I=0.000000, Local_Q=1.063248, Remote_I=-0.003730, Remote_Q=0.989990,SNR_L=0,SNR_R=0 Tone 44: Local_I=0.000000, Local_Q=0.025321, Remote_I=-0.014554, Remote_Q=0.000000,SNR_L=168,SNR_R=1 Tone 45: Local_I=0.000000, Local_Q=1.004360, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=37,SNR_R=4 Tone 46: Local_I=0.000000, Local_Q=0.318604, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=1,SNR_R=0 Tone 47: Local_I=0.000000, Local_Q=1.223072, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=32,SNR_R=0 Tone 48: Local_I=0.000000, Local_Q=-0.314080, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=1,SNR_R=1 Tone 49: Local_I=0.000000, Local_Q=1.205255, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 50: Local_I=0.000000, Local_Q=0.452522, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 51: Local_I=0.000000, Local_Q=1.155632, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 52: Local_I=0.000000, Local_Q=-0.026713, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=32,SNR_R=1 Tone 53: Local_I=0.000000, Local_Q=1.043586, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=1,SNR_R=0 Tone 54: Local_I=0.000000, Local_Q=0.073772, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=2,SNR_R=0 Tone 55: Local_I=0.000000, Local_Q=1.200665, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 56: Local_I=0.000000, Local_Q=-0.292900, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=1,SNR_R=128 Tone 57: Local_I=0.000000, Local_Q=1.324037, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=229,SNR_R=32 Tone 58: Local_I=-0.000000, Local_Q=0.217820, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=1,SNR_R=1 Tone 59: Local_I=0.000000, Local_Q=1.011400, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=32 Tone 60: Local_I=0.000000, Local_Q=-0.087040, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=1,SNR_R=10 Tone 61: Local_I=0.000000, Local_Q=1.125535, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=215 Tone 62: Local_I=0.000000, Local_Q=0.016311, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=163 Tone 63: Local_I=0.000000, Local_Q=1.191338, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=59 Tone 64: Local_I=0.000000, Local_Q=-0.300437, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=80,SNR_R=0 Tone 65: Local_I=0.000000, Local_Q=1.076641, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 66: Local_I=0.000000, Local_Q=-0.170418, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 67: Local_I=1.156143, Local_Q=1.094297, Remote_I=-0.011643, Remote_Q=0.000000,SNR_L=0,SNR_R=0 Tone 68: Local_I=-0.004231, Local_Q=0.060723, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=32,SNR_R=205 Tone 69: Local_I=927628.562500, Local_Q=1.003504, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=35,SNR_R=204 Tone 70: Local_I=0.000000, Local_Q=0.514295, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=1,SNR_R=204 Tone 71: Local_I=-0.000185, Local_Q=1.314303, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=32,SNR_R=61 Tone 72: Local_I=0.000000, Local_Q=-0.576333, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=125,SNR_R=149 Tone 73: Local_I=0.000000, Local_Q=1.044520, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=79,SNR_R=191 Tone 74: Local_I=0.000000, Local_Q=0.036442, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=0,SNR_R=214 Tone 75: Local_I=0.000000, Local_Q=1.024319, Remote_I=0.001758, Remote_Q=0.000000,SNR_L=0,SNR_R=51 Tone 76: Local_I=0.000000, Local_Q=-0.129110, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=32,SNR_R=164 Tone 77: Local_I=0.000000, Local_Q=1.248342, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=1,SNR_R=112 Tone 78: Local_I=0.000000, Local_Q=-0.416730, Remote_I=0.000000, Remote_Q=0.000000,SNR_L=2,SNR_R=125 Tone 79: Local_I=0.000000, Local_Q=1.890061, Remote_I=0.025694, Remote_Q=1.216809,SNR_L=0,SNR_R=63