Printing IQ-Data

I'm currently experimenting with the direction finding sample. I wanted to print the IQ-Samples to a serial port and used a code example that I found in a similar ticket. I added the lines 9-13 in the function cte_recv_cb. 

static void cte_recv_cb(struct bt_le_per_adv_sync *sync,
			struct bt_df_per_adv_sync_iq_samples_report const *report)
{
	printk("CTE[%u]: samples count %d, cte type %s, slot durations: %u [us], "
	       "packet status %s, RSSI %i\n",
	       bt_le_per_adv_sync_get_index(sync), report->sample_count,
	       cte_type2str(report->cte_type), report->slot_durations,
	       packet_status2str(report->packet_status), report->rssi);
	printk("#IQ-Samples: %d\n", report->sample_count);

	for(int i=0; i<report->sample_count; i++){
		printk("[%d]: I:%d Q:%d,\n", i, report->sample[i].i, report->sample[i].q);
	}
}

But when I read the data with the serial Terminal some lines are always skipped. I am using the all the default values in the configuration of the serial terminal (and Baudrate 115200).

Even if i do simpler prints like only the one from the sample + the sample count I get some uncomplete lines like you can see in the picture below.

Do you have any idea why this occurs?

Thanks for your help in advance!

  • Hi

    I think this is due to the IQ samples being captured faster than you're able to print them over to the terminal causing data to be lost. Either way, why do you need to print the raw IQ data at all onto your device? I'd recommend storing this and printing it out after converting the IQ data instead. The data from our samples is only raw IQ data and it must be converted into vector form to be reviewed properly. We don't have have any specific sample code showing this, but you can check out this page for information on the various formulas used to translate IQ data between polar and rectangular form. 

    Best regards,
    Simon

Related