| | |
| | | /* |
| | | * 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. |
| | |
| | | // 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 |
| | | |
| | |
| | | } |
| | | #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 |
| | | { |
| | |
| | | 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; |
| | |
| | | SFD_cnt); |
| | | #endif |
| | | } |
| | | |
| | | // phy_dump_rx_iq(128 * 1024, get_s8); |
| | | #if RSSI_EN |
| | | if (ind->status != 0x0830) |
| | | { |