hardware:nrf5340dk
case:Bluetooth: Direction finding central/peripheral
I modified the code to change the quantization level of the I and Q data received by the receiver to 16 bits. In fact, the I and Q data I received did indeed become 16 bit quantization level data. Callback function for receiving IQ data:
static void cte_recv_cb(struct bt_conn *conn, struct bt_df_conn_iq_samples_report const *report) { char addr[BT_ADDR_LE_STR_LEN]; bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); if (report->err == BT_DF_IQ_REPORT_ERR_SUCCESS) { printk("%d\n", report->chan_idx); for (uint8_t idx = 0; idx < report->sample_count; idx++) { if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) { printk(" %d\t%d\n", report->sample16[idx].i, report->sample16[idx].q); } } } else { printk("CTE[%s]: request failed, err %u\n", addr, report->err); } }
But in reality, the IQ data sent by the sender is still 8-bit, because I found that only when if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT)
is IQ data printed, and if (report->sample_type == BT_DF_IQ_SAMPLE_16_BITS_INT), data is not printed.
The definition of bt_df_iq_sample is as follows:
enum bt_df_iq_sample { /** Reported IQ samples have 8 bits signed integer format. Size defined in BT Core 5.3 * Vol 4, Part E sections 7.7.65.21 and 7.7.65.22. */ BT_DF_IQ_SAMPLE_8_BITS_INT, /** Reported IQ samples have 16 bits signed integer format. Vendor specific extension. */ BT_DF_IQ_SAMPLE_16_BITS_INT, };
That is to say, although I chose to print 16 bit quantization level IQ data at the receiver (the printed data is indeed 16 bit), it seems that the sender still sends 8 bits, and I cannot find the code to modify the quantization level of the sender's IQ data at the sender.
So I'm a bit confused about this code:
for (uint8_t idx = 0; idx < report->sample_count; idx++) {
if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) {/*Changging it to BT_DF_IQ_SAMPLE_16_BITS_INT,It doesnot print anything*/
printk(" %d\t%d\n", report->sample16[idx].i,
report->sample16[idx].q);
}
}
In reality, the sender only sends a waveform, and the quantization process should be carried out by the receiver. Why is my report 8-bit and I can print IQ data with 16 bit quantization level?