From adfc7e798b9cbdd022bf8df971843436912a0fe5 Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期日, 20 七月 2025 16:58:30 +0800 Subject: [PATCH] 成功移植g_com_map表逻辑,初步测试能读能写,并且TDOA效果和官方一致 --- keil/include/components/app/src/uwb_trx_task.c | 59 +++++++++++++++++++++++------------------------------------ 1 files changed, 23 insertions(+), 36 deletions(-) diff --git a/keil/include/components/app/src/uwb_trx_task.c b/keil/include/components/app/src/uwb_trx_task.c index 7e9db70..03a32c2 100644 --- a/keil/include/components/app/src/uwb_trx_task.c +++ b/keil/include/components/app/src/uwb_trx_task.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2023 Beijing Hanwei Innovation Technology Ltd. Co. and + * Copyright (c) 2019-2025 Beijing Hanwei Innovation Technology Ltd. Co. and * its subsidiaries and affiliates (collectly called MKSEMI). * * All rights reserved. @@ -52,6 +52,9 @@ // extern uint16_t g_sts_main_path_loc; // extern uint16_t g_sts_fap_loc; #endif +#if RANGING_EN +static uint16_t rx_timestamp_frac = 0; +#endif #define PAYLOAD_PRINT_EN 0 @@ -92,6 +95,13 @@ } #endif LOG_INFO(TRACE_NO_OPTION | TRACE_MODULE_UWB, "\r\n"); +#if RANGING_EN + LOG_INFO(TRACE_MODULE_APP, "TX timestamp %u %u\r\n", ind->timestamp_int, ind->timestamp_frac); + if (rx_timestamp_frac != 0x8000) + { + LOG_INFO(TRACE_MODULE_APP, "Loopback time $%d;\r\n", rx_timestamp_frac - ind->timestamp_frac); + } +#endif } else { @@ -121,49 +131,24 @@ int32_t freq_offset = phy_freq_offset_get(); int32_t freq_offset_filter = average_filter(freq_offset); LOG_INFO(TRACE_MODULE_APP, "CH Freq Offset %d\r\n", freq_offset_filter); +#if RANGING_EN + LOG_INFO(TRACE_MODULE_APP, "RX timestamp %u %u\r\n", ind->timestamp_int, ind->timestamp_frac); + rx_timestamp_frac = ind->timestamp_frac; +#endif #if CSI_EN // need to increase slot duration for log printing -#if 0 - ranging_first_path_detect(ind->rssi); - LOG_INFO(TRACE_MODULE_UWB, "main tap: %d first tap: %d \r\n", g_main_path_loc, g_fap_loc); - - if ((uwb_app_config.ppdu_params.sts_pkt_cfg == SP1) || (uwb_app_config.ppdu_params.sts_pkt_cfg == SP3)) - { - if (sts_valid_check()) - { - sts_first_path_detect(ind->rssi, &g_sts_main_path_loc, &g_sts_fap_loc); - LOG_INFO(TRACE_MODULE_UWB, "main tap: %d first tap: %d \r\n", g_sts_main_path_loc, g_sts_fap_loc); - } - else - { - LOG_INFO(TRACE_MODULE_UWB, "STS invalid\r\n"); - } - } + // auto_adjust_filter_coeff(0); + print_preamble_cir(0, 0, 1); + print_sts_cir(0, 1); #endif - struct RANGING_TAPS_INF_T taps_inf; - ranging_taps_inf_get(&taps_inf); - LOG_INFO(TRACE_MODULE_APP, "NLoS: %d, FoM: %u \r\n", taps_inf.NLoS, taps_inf.FoM); - // LOG_INFO(TRACE_MODULE_APP, "fap: %d, %f\r\n", taps_inf.fap_loc, taps_inf.fap_pow); - // LOG_INFO(TRACE_MODULE_APP, "tap1: %d, %f\r\n", taps_inf.tap1_loc, taps_inf.tap1_pow); - // LOG_INFO(TRACE_MODULE_APP, "tap2: %d, %f\r\n", taps_inf.tap2_loc, taps_inf.tap2_pow); - // LOG_INFO(TRACE_MODULE_APP, "tap3: %d, %f\r\n", taps_inf.tap3_loc, taps_inf.tap3_pow); - - // float chtaps_re[128]; - // float chtaps_im[128]; - // ranging_multi_taps_iq_get(chtaps_re, chtaps_im, 128); - // for (uint8_t i = 0; i < 128; i++) - // { - // LOG_INFO(TRACE_NO_OPTION | TRACE_MODULE_APP, "%f, %f\r\n", chtaps_re[i], chtaps_im[i]); - // } -#endif - - // print_preamble_chest(1, 1); - // print_sts_ch_taps(1); } else { LOG_INFO(TRACE_MODULE_UWB, "UWB RX fail 0x%04x\r\n", ind->status); +#if RANGING_EN + rx_timestamp_frac = 0x8000; +#endif #if 0 uint8_t BD_err = (ind->status >> 4) & 0x1; uint8_t SFD_err = (ind->status >> 3) & 0x1; @@ -178,6 +163,8 @@ SFD_cnt); #endif } + + // phy_dump_rx_iq(128 * 1024, get_s8); #if RSSI_EN if (ind->status != 0x0830) { -- Gitblit v1.9.3