| | |
| | | ind->rx.phy_timer_count = rx->timestamp; |
| | | ind->rx.phr_bits = (uint16_t)rx->phy_header; |
| | | ind->rx.status = rx->err_code; |
| | | ind->rx.rssi = rx->rssi; |
| | | ind->rx.snr = rx->snr; |
| | | // ind->rx.rssi = rx->rssi; |
| | | // ind->rx.snr = rx->snr; |
| | | ind->rx.rssi = correct_rssi(rx->rssi); |
| | | ind->rx.snr = correct_snr(rx->snr); |
| | | |
| | | #if CSI_EN |
| | | if (ranging_debug_csi_en_get() == 0) |
| | | { |
| | | ranging_debug_csi_en_set(1); |
| | | } |
| | | #endif |
| | | |
| | | if (rx->err_code == UWB_RX_OK) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | #if CSI_EN |
| | | if (ranging_debug_csi_en_get()) |
| | | { |
| | | uint8_t frame_idx = 0; |
| | | debug_csi.frame_idx = frame_idx; |
| | | |
| | | uint32_t val = REG_READ(0x40003050); |
| | | debug_csi.frame[frame_idx].rf_gain = (val & 0x07); |
| | | debug_csi.frame[frame_idx].bb_gain = ((val >> 3) & 0x1f); |
| | | debug_csi.frame[frame_idx].bd_cnt = phy_bd_cnt_get(); |
| | | debug_csi.frame[frame_idx].sfd_cnt = phy_sfd_cnt_get(); |
| | | debug_csi.frame[frame_idx].error_code = ind->rx.status; |
| | | if (rx->err_code != 0x0830) |
| | | { |
| | | debug_csi.frame[frame_idx].rssi = ind->rx.rssi; |
| | | debug_csi.frame[frame_idx].snr = ind->rx.snr; |
| | | debug_csi.frame[frame_idx].channel_power = REG_READ(0x40002064); |
| | | debug_csi.frame[frame_idx].noise_power = REG_READ(0x40002078); |
| | | dump_preamble_cir(frame_idx, 128); |
| | | dump_sts_cir(frame_idx); |
| | | } |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | // Send the message |