The number of IQ data printed at once seems to be limited.

Hi,I have encountered some problems:

hardware: nrf5340-dk

software:Visual Studio Code

ncs:2.5.0

sample: nrf\samples\bluetooth\direction_finding_central  &  direction_finding_peripheral (AoD mode)

issue:After successfully connecting two nrf5340dk, I attempted to print the received IQ data. Due to the fact that the code in the nrf library does not have the ability to print IQ data, I copy the code for printing IQ data from the zephyr library. However, when printing IQ data in the cteRecv_cb() function, actually, 46 messages should be printed at once, including one prompt message(such as:CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -300)and 45 IQ data pairs. But in fact, only a maximum of 25 pieces of data can be printed,and 21 messages dropped.The number of data printed at once seems to be limited. The tests I conducted afterwards also confirmed this, and I don't know where the code went wrong.

I modified the code and conducted several tests:

1.modified code in main.c:(copy the code for printing IQ data from the zephyr library)

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("CTE[%s]: samples count %d, cte type %s, slot durations: %u [us], "
		       "packet status %s, RSSI %i\n",
		       addr, report->sample_count, cte_type2str(report->cte_type),
		       report->slot_durations, packet_status2str(report->packet_status),
		       report->rssi);

			for (uint8_t idx = 0; idx < report->sample_count; idx++) {
				if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) {
					printk(" IQ[%d]: %d, %d\n", idx, report->sample[idx].i,
					       report->sample[idx].q);
				} 
			}
		
	} else {
		printk("CTE[%s]: request failed, err %u\n", addr, report->err);
	}
}

Serial port printing log:The first 21 messages were dropped

 IQ[20]: -128, 38
--- 21 messages dropped ---
 IQ[21]: -121, 44
 IQ[22]: -104, 87
 IQ[23]: -106, 86
 IQ[24]: -89, 102
 IQ[25]: -80, 110
 IQ[26]: -60, 124
 IQ[27]: -44, -128
 IQ[28]: -20, -128
 IQ[29]: -29, -128
 IQ[30]: 9, -128
 IQ[31]: 39, -128
 IQ[32]: 37, -128
 IQ[33]: 62, 120
 IQ[34]: 87, 104
 IQ[35]: 77, 112
 IQ[36]: 88, 101
 IQ[37]: 108, 84
 IQ[38]: 122, 55
 IQ[39]: -128, 42
 IQ[40]: -128, 45
 IQ[41]: -128, 3
 IQ[42]: -128, 5
 IQ[43]: -128, -21
 IQ[44]: -128, -41
 IQ[20]: 78, 100
--- 21 messages dropped ---
 IQ[21]: 87, 95
 IQ[22]: 107, 79
 IQ[23]: 111, 66
 IQ[24]: 122, 41
 IQ[25]: 126, 31
 IQ[26]: -128, 14
 IQ[27]: -128, 6
 IQ[28]: -128, -14
 IQ[29]: 126, -33
 IQ[30]: 122, -43
 IQ[31]: 105, -70
 IQ[32]: 102, -80
 IQ[33]: 101, -80
 IQ[34]: 76, -106
 IQ[35]: 74, -104
 IQ[36]: 36, -126
 IQ[37]: 49, -124
 IQ[38]: 28, -127
 IQ[39]: 4, -128
 IQ[40]: -12, -128
 IQ[41]: -36, -123
 IQ[42]: -39, -123
 IQ[43]: -49, -120
 IQ[44]: -70, -109
 IQ[20]: -78, 87
--- 21 messages dropped ---
 IQ[21]: -54, 104
 IQ[22]: -53, 103
 IQ[23]: -35, 110
 IQ[24]: -15, 116
 IQ[25]: -9, 117
 IQ[26]: 9, 116
 IQ[27]: 28, 112
 IQ[28]: 33, 111
 IQ[29]: 57, 101
 IQ[30]: 62, 102
 IQ[31]: 84, 81
 IQ[32]: 90, 74
 IQ[33]: 94, 69
 IQ[34]: 102, 54
 IQ[35]: 104, 49
 IQ[36]: 111, 34
 IQ[37]: 114, 12
 IQ[38]: 118, -8
 IQ[39]: 113, -25
 IQ[40]: 113, -26
 IQ[41]: 108, -51
 IQ[42]: 103, -58
 IQ[43]: 93, -73
 IQ[44]: 88, -80
 IQ[20]: 19, -128
--- 21 messages dropped ---
 IQ[21]: 10, -128
 IQ[22]: -9, -128
 IQ[23]: -26, -128
 IQ[24]: -38, -128
 IQ[25]: -61, -120
 IQ[26]: -67, -120
 IQ[27]: -69, -116
 IQ[28]: -97, -99
 IQ[29]: -102, -91
 IQ[30]: -127, -54
 IQ[31]: -128, -53
 IQ[32]: -128, -40
 IQ[33]: -128, -18
 IQ[34]: -128, 2
 IQ[35]: -128, 7
 IQ[36]: -128, 32
 IQ[37]: -128, 46
 IQ[38]: -122, 53
 IQ[39]: -112, 75
 IQ[40]: -99, 99
 IQ[41]: -84, 108
 IQ[42]: -83, 107
 IQ[43]: -49, 125
 IQ[44]: -46, -128
 IQ[20]: 12, -128
--- 21 messages dropped ---
 IQ[21]: 34, 127
 IQ[22]: 35, -128
 IQ[23]: 70, 119
 IQ[24]: 68, 116
 IQ[25]: 93, 100
 IQ[26]: 99, 93
 IQ[27]: 112, 77
 IQ[28]: 118, 64
 IQ[29]: 122, 44
 IQ[30]: -128, 12
 IQ[31]: -128, 3
 IQ[32]: -128, -10
 IQ[33]: -128, -10
 IQ[34]: -128, -34
 IQ[35]: 120, -65
 IQ[36]: 109, -74
 IQ[37]: 94, -100
 IQ[38]: 98, -94
 IQ[39]: 66, -118
 IQ[40]: 73, -117
 IQ[41]: 61, -117
 IQ[42]: 34, -128
 IQ[43]: 18, -128
 IQ[44]: 8, -128
 IQ[20]: -55, -120
--- 21 messages dropped ---
 IQ[21]: -70, -112
 IQ[22]: -76, -111
 IQ[23]: -100, -95
 IQ[24]: -104, -86
 IQ[25]: -126, -59
 IQ[26]: -128, -48
 IQ[27]: -128, -18
 IQ[28]: -128, -20
 IQ[29]: -128, -10
 IQ[30]: -128, 36
 IQ[31]: -126, 42
 IQ[32]: -128, 44
 IQ[33]: -118, 63
 IQ[34]: -112, 74
 IQ[35]: -93, 94
 IQ[36]: -86, 102
 IQ[37]: -67, 120
 IQ[38]: -54, 120
 IQ[39]: -34, -128
 IQ[40]: -34, -128
 IQ[41]: -15, -128
 IQ[42]: 5, -128
 IQ[43]: 20, -128
 IQ[44]: 37, -128
 IQ[20]: -72, -91
--- 21 messages dropped ---
 IQ[21]: -87, -80
 IQ[22]: -95, -68
 IQ[23]: -99, -56
 IQ[24]: -108, -44
 IQ[25]: -114, -13
 IQ[26]: -114, -8
 IQ[27]: -119, -4
 IQ[28]: -115, 22
 IQ[29]: -116, 32
 IQ[30]: -109, 49
 IQ[31]: -109, 47
 IQ[32]: -86, 77
 IQ[33]: -87, 81
 IQ[34]: -68, 96
 IQ[35]: -59, 104
 IQ[36]: -44, 108
 IQ[37]: -36, 111
 IQ[38]: -32, 113
 IQ[39]: -15, 118
 IQ[40]: 3, 117
 IQ[41]: 31, 113
 IQ[42]: 34, 111
 IQ[43]: 53, 101
 IQ[44]: 64, 100
 IQ[20]: -33, -128
--- 21 messages dropped ---
 IQ[21]: -58, -117
 IQ[22]: -81, -105
 IQ[23]: -73, -107
 IQ[24]: -91, -89
 IQ[25]: -115, -78
 IQ[26]: -121, -62
 IQ[27]: -126, -50
 IQ[28]: -124, -36
 IQ[29]: -124, -39
 IQ[30]: -128, -15
 IQ[31]: -124, 35
 IQ[32]: -128, 31
 IQ[33]: -113, 45
 IQ[34]: -111, 65
 IQ[35]: -99, 77
 IQ[36]: -95, 99
 IQ[37]: -73, 97
 IQ[38]: -62, 115
 IQ[39]: -63, 115
 IQ[40]: -48, 119
 IQ[41]: -34, -128
 IQ[42]: -14, 126
 IQ[43]: 5, -128
 IQ[44]: 34, 126
 IQ[20]: 84, 120
--- 21 messages dropped ---
 IQ[21]: 83, 117
 IQ[22]: 109, 104
 IQ[23]: 106, 100
 IQ[24]: 123, 71
 IQ[25]: -128, 49
 IQ[26]: -128, 32
 IQ[27]: -128, 31
 IQ[28]: -128, 6
 IQ[29]: -128, -19
 IQ[30]: -128, -25
 IQ[31]: -128, -49
 IQ[32]: 121, -75
 IQ[33]: 113, -92
 IQ[34]: 94, -111
 IQ[35]: 90, -113
 IQ[36]: 45, -128
 IQ[37]: 69, -128
 IQ[38]: 22, -128
 IQ[39]: 28, -128
 IQ[40]: -1, -128
 IQ[41]: -8, -128
 IQ[42]: -37, -128
 IQ[43]: -61, -128
 IQ[44]: -60, -128
 IQ[20]: 51, 124
--- 21 messages dropped ---
 IQ[21]: 73, 115
 IQ[22]: 81, 107
 IQ[23]: 97, 100
 IQ[24]: 109, 79
 IQ[25]: 121, 69
 IQ[26]: -128, 35
 IQ[27]: 123, 50
 IQ[28]: -128, 13
 IQ[29]: -128, -1
 IQ[30]: -128, -21
 IQ[31]: -128, -27
 IQ[32]: 117, -62
 IQ[33]: 127, -57
 IQ[34]: 106, -83
 IQ[35]: 83, -109
 IQ[36]: 88, -102
 IQ[37]: 63, -121
 IQ[38]: 44, -128
 IQ[39]: 36, -128
 IQ[40]: 21, -128
 IQ[41]: 8, -128
 IQ[42]: -11, -128
 IQ[43]: -36, -128
 IQ[44]: -44, -128
 IQ[20]: -62, 99
--- 21 messages dropped ---
 IQ[21]: -50, 106
 IQ[22]: -23, 116
 IQ[23]: -20, 117
 IQ[24]: -13, 115
 IQ[25]: 6, 116
 IQ[26]: 36, 112
 IQ[27]: 48, 107
 IQ[28]: 59, 100
 IQ[29]: 60, 100
 IQ[30]: 84, 81
 IQ[31]: 87, 77
 IQ[32]: 108, 52
 IQ[33]: 109, 51
 IQ[34]: 112, 41
 IQ[35]: 114, 16
 IQ[36]: 115, 15
 IQ[37]: 117, -5
 IQ[38]: 114, -13
 IQ[39]: 112, -31
 IQ[40]: 107, -50
 IQ[41]: 92, -71
 IQ[42]: 94, -69
 IQ[43]: 87, -81
 IQ[44]: 57, -104
 IQ[20]: -125, -14
--- 21 messages dropped ---
 IQ[21]: -128, -5
 IQ[22]: -128, 9
 IQ[23]: -128, 9
 IQ[24]: -122, 49
 IQ[25]: -114, 54
 IQ[26]: -115, 52
 IQ[27]: -102, 81
 IQ[28]: -91, 88
 IQ[29]: -64, 105
 IQ[30]: -70, 102
 IQ[31]: -49, 114
 IQ[32]: -25, 125
 IQ[33]: -18, -128
 IQ[34]: -1, 122
 IQ[35]: 23, 124
 IQ[36]: 29, 124
 IQ[37]: 50, 116
 IQ[38]: 66, 109
 IQ[39]: 77, 100
 IQ[40]: 98, 82
 IQ[41]: 96, 80
 IQ[42]: 114, 58
 IQ[43]: 116, 56
 IQ[44]: 118, 38
 IQ[20]: 70, 90
--- 21 messages dropped ---

2.modified code:(Print only the first 25 pairs of 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("CTE[%s]: samples count %d, cte type %s, slot durations: %u [us], "
		       "packet status %s, RSSI %i\n",
		       addr, report->sample_count, cte_type2str(report->cte_type),
		       report->slot_durations, packet_status2str(report->packet_status),
		       report->rssi);

			for (uint8_t idx = 0; idx < (report->sample_count-21); idx++) {
				if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) {
					printk(" IQ[%d]: %d, %d\n", idx, report->sample[idx].i,
					       report->sample[idx].q);
				} 
			}
		
	} else {
		printk("CTE[%s]: request failed, err %u\n", addr, report->err);
	}
}

Serial port printing log:(1 messages dropped )

*** Booting nRF Connect SDK v2.5.0 ***
[00:00:00.433,929] <inf> bt_hci_core: hci_vs_init: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.433,990] <inf> bt_hci_core: hci_vs_init: HW Variant: nRF53x (0x0003)
--- 8 messages dropped ---
[DEVICE]: 58:BA:C9:4F:41:5E (random), AD evt type 0, AD data len 18, RSSI -68
[AD]: 1 data_len 1
[AD]: 10 data_len 1
[AD]: 255 data_len 10
[DEVICE]: 58:BA:C9:4F:41:5E (random), AD evt type 4, AD data len 0, RSSI -68
[DEVICE]: FC:02:F2:8B:8A:8E (public), AD evt type 0, AD data len 20, RSSI -80
[AD]: 1 data_len 1
[AD]: 255 data_len 4
[AD]: 9 data_len 9
[DEVICE]: 2F:01:D3:B4:B7:92 (random), AD evt type 3, AD data len 31, RSSI -77
[DEVICE]: 71:82:15:F0:41:C3 (random), AD evt type 0, AD data len 17, RSSI -89
[AD]: 1 data_len 1
[AD]: 10 data_len 1
[AD]: 255 data_len 9
[DEVICE]: 71:82:15:F0:41:C3 (random), AD evt type 4, AD data len 0, RSSI -89
[DEVICE]: 35:F7:6A:52:3F:A0 (random), AD evt type 3, AD data len 31, RSSI -89
[DEVICE]: DF:51:35:BB:2D:FC (random), AD evt type 0, AD data len 8, RSSI -36
[AD]: 1 data_len 1
[AD]: 39 data_len 3
 IQ[0]: -62, -126
--- 6 messages dropped ---
 IQ[1]: -128, -59
 IQ[2]: 55, 126
 IQ[3]: -128, 44
 IQ[4]: -56, -128
 IQ[5]: -128, -52
 IQ[6]: 34, -128
 IQ[7]: -128, 26
 IQ[8]: 20, -128
 IQ[9]: 16, -128
 IQ[10]: -4, -128
 IQ[11]: -25, -128
 IQ[12]: -44, -128
 IQ[13]: -63, 125
 IQ[14]: -63, 127
 IQ[15]: -84, 111
 IQ[16]: -102, 101
 IQ[17]: -102, 94
 IQ[18]: -112, 88
 IQ[19]: -128, 59
 IQ[20]: -128, 49
 IQ[21]: -128, 24
 IQ[22]: -128, 5
 IQ[23]: -128, -4
 IQ[0]: -11, 122
--- 1 messages dropped ---
 IQ[1]: 20, -120
 IQ[2]: -26, 118
 IQ[3]: 12, -120
 IQ[4]: -11, 125
 IQ[5]: 2, -125
 IQ[6]: -7, 121
 IQ[7]: -10, -124
 IQ[8]: 11, 123
 IQ[9]: 28, 121
 IQ[10]: 56, 113
 IQ[11]: 71, 100
 IQ[12]: 72, 99
 IQ[13]: 83, 93
 IQ[14]: 101, 65
 IQ[15]: 105, 60
 IQ[16]: 113, 53
 IQ[17]: 120, 42
 IQ[18]: 120, 25
 IQ[19]: 122, 6
 IQ[20]: 124, -2
 IQ[21]: 121, -20
 IQ[22]: 116, -38
 IQ[23]: 111, -53
 IQ[0]: -111, -39
--- 1 messages dropped ---
 IQ[1]: 116, 24
 IQ[2]: -114, -26
 IQ[3]: 116, 26
 IQ[4]: -111, -34
 IQ[5]: 113, 21
 IQ[6]: -121, -5
 IQ[7]: 117, -10
 IQ[8]: -121, -2
 IQ[9]: -115, 12
 IQ[10]: -110, 41
 IQ[11]: -113, 29
 IQ[12]: -112, 46
 IQ[13]: -101, 68
 IQ[14]: -71, 95
 IQ[15]: -87, 80
 IQ[16]: -55, 103
 IQ[17]: -50, 105
 IQ[18]: -46, 108
 IQ[19]: -30, 113
 IQ[20]: -2, 118
 IQ[21]: -8, 120
 IQ[22]: 22, 116
 IQ[23]: 37, 114
 IQ[0]: -91, 82
--- 1 messages dropped ---
 IQ[1]: 91, -76
 IQ[2]: -96, 70
 IQ[3]: 100, -63
 IQ[4]: -101, 68
 IQ[5]: 91, -76
 IQ[6]: -85, 84
 IQ[7]: 84, -85
 IQ[8]: -82, 90
 IQ[9]: -60, 107
 IQ[10]: -62, 104
 IQ[11]: -36, 116
 IQ[12]: -23, 122
 IQ[13]: -20, 117
 IQ[14]: 5, 120
 IQ[15]: 7, 119
 IQ[16]: 50, 111
 IQ[17]: 53, 104
 IQ[18]: 65, 101
 IQ[19]: 61, 103
 IQ[20]: 76, 91
 IQ[21]: 102, 63
 IQ[22]: 101, 67
 IQ[23]: 111, 46
 IQ[0]: -128, -4
--- 1 messages dropped ---
 IQ[1]: -128, -2
 IQ[2]: -126, 2
 IQ[3]: -128, -8
 IQ[4]: -128, 7
 IQ[5]: 126, -24
 IQ[6]: -126, 28
 IQ[7]: 123, -25
 IQ[8]: -121, 31
 IQ[9]: -116, 58
 IQ[10]: -110, 64
 IQ[11]: -94, 85
 IQ[12]: -87, 91
 IQ[13]: -70, 106
 IQ[14]: -52, 117
 IQ[15]: -48, 114
 IQ[16]: -39, 121
 IQ[17]: -4, 124
 IQ[18]: -8, 126
 IQ[19]: 19, 127
 IQ[20]: 30, 126
 IQ[21]: 43, 119
 IQ[22]: 57, 110
 IQ[23]: 74, 104
 IQ[0]: -60, 111
--- 1 messages dropped ---
 IQ[1]: 57, -115
 IQ[2]: -37, 120
 IQ[3]: 36, -120
 IQ[4]: -33, 123
 IQ[5]: 41, -114
 IQ[6]: -40, 120
 IQ[7]: 21, -125
 IQ[8]: -12, 123
 IQ[9]: -9, 124
 IQ[10]: 18, 124
 IQ[11]: 42, 118
 IQ[12]: 42, 115
 IQ[13]: 52, 113
 IQ[14]: 89, 88
 IQ[15]: 66, 106
 IQ[16]: 96, 77
 IQ[17]: 100, 78
 IQ[18]: 115, 53
 IQ[19]: 122, 23
 IQ[20]: 121, 41
 IQ[21]: 124, 7
 IQ[22]: 126, 2
 IQ[23]: 122, -25
 IQ[0]: 4, -128
--- 1 messages dropped ---

3.modified code:(Print only the first 24 pairs of 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("CTE[%s]: samples count %d, cte type %s, slot durations: %u [us], "
		       "packet status %s, RSSI %i\n",
		       addr, report->sample_count, cte_type2str(report->cte_type),
		       report->slot_durations, packet_status2str(report->packet_status),
		       report->rssi);

			for (uint8_t idx = 0; idx < (report->sample_count-22); idx++) {
				if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) {
					printk(" IQ[%d]: %d, %d\n", idx, report->sample[idx].i,
					       report->sample[idx].q);
				} 
			}
		
	} else {
		printk("CTE[%s]: request failed, err %u\n", addr, report->err);
	}
}

Serial port printing log:(no messages dropped )

*** Booting nRF Connect SDK v2.5.0 ***
[00:00:00.434,509] <inf> bt_hci_core: hci_vs_init: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.434,570] <inf> bt_hci_core: hci_vs_init: HW Variant: nRF53x (0x0003)
[00:00:00.434,600] <inf> bt_hci_core: hci_vs_init: Firmware: Standard Bluetooth controller (0x00) Version 3.4 Build 99
[00:00:00.436,096] <wrn> bt_ecc: bt_pub_key_gen: ECC HCI commands not available
[00:00:00.436,187] <inf> bt_hci_core: bt_dev_show_info: Identity: F4:3C:80:4D:E1:2A (random)
[00:00:00.436,218] <inf> bt_hci_core: bt_dev_show_info: HCI: version 5.4 (0x0d) revision 0x0000, manufacturer 0x05f1
[00:00:00.436,248] <inf> bt_hci_core: bt_dev_show_info: LMP: version 5.4 (0x0d) subver 0xffff
Bluetooth initialized
Scanning successfully started
[DEVICE]: FC:02:F2:8B:8A:8E (public), AD evt type 0, AD data len 20, RSSI -85
[AD]: 1 data_len 1
[AD]: 255 data_len 4
[AD]: 9 data_len 9
[DEVICE]: 33:DD:5C:C6:7A:2D (random), AD evt type 3, AD data len 31, RSSI -52
[DEVICE]: 41:AA:66:D1:B5:18 (public), AD evt type 0, AD data len 31, RSSI -65
[AD]: 255 data_len 13
[AD]: 9 data_len 14
[DEVICE]: 41:AA:66:D1:B5:18 (public), AD evt type 4, AD data len 18, RSSI -65
[DEVICE]: 71:AA:4C:E1:2F:A1 (random), AD evt type 2, AD data len 31, RSSI -76
[DEVICE]: 63:3E:5C:3E:68:25 (random), AD evt type 0, AD data len 17, RSSI -85
[AD]: 1 data_len 1
[AD]: 10 data_len 1
[AD]: 255 data_len 9
[DEVICE]: DF:51:35:BB:2D:FC (random), AD evt type 0, AD data len 8, RSSI -35
[AD]: 1 data_len 1
[AD]: 39 data_len 3
 IQ[0]: -128, 70
--- 6 messages dropped ---
 IQ[1]: -63, -128
 IQ[2]: -128, -71
 IQ[3]: 76, -128
 IQ[4]: 122, 77
 IQ[5]: -92, 117
 IQ[6]: -127, -86
 IQ[7]: 77, -128
 IQ[8]: -118, -86
 IQ[9]: -107, -109
 IQ[10]: -86, -124
 IQ[11]: -77, -126
 IQ[12]: -59, -128
 IQ[13]: -42, -128
 IQ[14]: -28, -128
 IQ[15]: -8, -128
 IQ[16]: 2, -128
 IQ[17]: 30, -128
 IQ[18]: 41, -128
 IQ[19]: 62, -128
 IQ[20]: 76, -128
 IQ[21]: 87, -120
 IQ[22]: 97, -112
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -360
 IQ[0]: 118, -59
 IQ[1]: -113, 64
 IQ[2]: 113, -73
 IQ[3]: -108, 73
 IQ[4]: 103, -85
 IQ[5]: -99, 90
 IQ[6]: 97, -91
 IQ[7]: -96, 93
 IQ[8]: 86, -97
 IQ[9]: 65, -115
 IQ[10]: 69, -113
 IQ[11]: 27, -128
 IQ[12]: 52, -120
 IQ[13]: 22, -128
 IQ[14]: 4, -128
 IQ[15]: -22, -128
 IQ[16]: -50, -122
 IQ[17]: -49, -125
 IQ[18]: -62, -118
 IQ[19]: -76, -112
 IQ[20]: -90, -101
 IQ[21]: -98, -92
 IQ[22]: -114, -64
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -360
 IQ[0]: -118, 67
 IQ[1]: 100, -89
 IQ[2]: -96, 88
 IQ[3]: 103, -85
 IQ[4]: -103, 88
 IQ[5]: 97, -89
 IQ[6]: -90, 98
 IQ[7]: 87, -103
 IQ[8]: -90, 98
 IQ[9]: -47, 125
 IQ[10]: -60, 119
 IQ[11]: -39, 123
 IQ[12]: -23, -128
 IQ[13]: 3, -128
 IQ[14]: 26, -128
 IQ[15]: 27, -128
 IQ[16]: 51, 121
 IQ[17]: 42, 125
 IQ[18]: 80, 105
 IQ[19]: 97, 82
 IQ[20]: 93, 92
 IQ[21]: 111, 74
 IQ[22]: 107, 71
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -360
 IQ[0]: -10, -128
 IQ[1]: 18, 125
 IQ[2]: -38, -126
 IQ[3]: 22, 125
 IQ[4]: -27, -128
 IQ[5]: 55, 115
 IQ[6]: -53, -118
 IQ[7]: 34, 120
 IQ[8]: -42, -119
 IQ[9]: -64, -113
 IQ[10]: -74, -104
 IQ[11]: -88, -97
 IQ[12]: -94, -88
 IQ[13]: -114, -56
 IQ[14]: -114, -58
 IQ[15]: -122, -36
 IQ[16]: -127, -18
 IQ[17]: -128, -4
 IQ[18]: -127, 8
 IQ[19]: -121, 29
 IQ[20]: -120, 47
 IQ[21]: -116, 50
 IQ[22]: -97, 79
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -360
 IQ[0]: -128, -3
 IQ[1]: -128, 9
 IQ[2]: -128, 11
 IQ[3]: 127, -16
 IQ[4]: -128, 10
 IQ[5]: -128, -19
 IQ[6]: -128, 37
 IQ[7]: 121, -45
 IQ[8]: -121, 53
 IQ[9]: -121, 47
 IQ[10]: -107, 72
 IQ[11]: -102, 85
 IQ[12]: -97, 86
 IQ[13]: -75, 104
 IQ[14]: -72, 108
 IQ[15]: -57, 121
 IQ[16]: -26, 125
 IQ[17]: -19, -128
 IQ[18]: -7, -128
 IQ[19]: 27, 124
 IQ[20]: 37, -128
 IQ[21]: 46, 124
 IQ[22]: 58, 118
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -360
 IQ[0]: 12, 126
 IQ[1]: -15, -128
 IQ[2]: 38, 122
 IQ[3]: -29, -126
 IQ[4]: 43, 122
 IQ[5]: -37, -124
 IQ[6]: 36, 123
 IQ[7]: -45, -124
 IQ[8]: 58, 110
 IQ[9]: 74, 107
 IQ[10]: 82, 100
 IQ[11]: 98, 86
 IQ[12]: 107, 74
 IQ[13]: 104, 73
 IQ[14]: 125, 39
 IQ[15]: 123, 38
 IQ[16]: 127, 14
 IQ[17]: 127, 2
 IQ[18]: 126, -34
 IQ[19]: -128, -24
 IQ[20]: 122, -36
 IQ[21]: 115, -56
 IQ[22]: 108, -70

Based on the results of the previous three tests, I found that I can only print a limited number of times at a time. But I looked at other people's code on the forum and it was the same as mine, but I was able to print 45 pairs of IQ data at once. I don't know where the problem is.

4.Afterwards, I tried to modify the code again and successfully printed 45 pairs of IQ data. But the order of IQ data has changed, making it inconvenient for me to proceed with subsequent data processing. Here is the test I conducted:

modified code:(Print only 23 times)

/*definition*/
int IQ_data1[46]={};
int IQ_data2[46]={};
int IQ_data3[46]={};
int IQ_data4[46]={};




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("CTE[%s]: samples count %d, cte type %s, slot durations: %u [us], "
		       "packet status %s, RSSI %i\n",
		       addr, report->sample_count, cte_type2str(report->cte_type),
		       report->slot_durations, packet_status2str(report->packet_status),
		       report->rssi);

			for (uint8_t idx = 0; idx < report->sample_count-22; idx++) {/*0-22*/
				if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) {
					IQ_data1[idx]=report->sample[idx].i;
					IQ_data2[idx]=report->sample[idx].q;		
				} 
			}

			for (uint8_t idx = report->sample_count-22; idx < report->sample_count; idx++) {/*23-44, its 22 is 0, so the printing result is correct*/
				if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) {
					IQ_data3[idx]=report->sample[idx].i;
					IQ_data4[idx]=report->sample[idx].q;				
				} 
			}

			for(int i=0;i<=22;i++){
				printk("%d\t%d\t%d\t%d\n",IQ_data1[i],IQ_data2[i],IQ_data3[i+22],IQ_data4[i+22]);
			}
		
	} else {
		printk("CTE[%s]: request failed, err %u\n", addr, report->err);
	}
}

Serial port printing log:(success

CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -420
55      25      0       0
-54     -29     -33     -54
55      30      -128    14
-62     -27     0       7
59      31      26      -31
-59     -27     -62     -38
60      23      100     -70
-51     3       -5      -5
-91     81      21      -48
4       6       -73     24
-5      49      58      -108
60      -13     0       -5
-25     127     -19     -47
-2      -2      -41     51
29      44      -32     -115
32      -51     -7      -5
13      -128    -39     -32
6       -8      -27     54
51      25      -84     -92
0       -65     -9      1
103     59      -51     -7
11      -9      33      54
44      -9      -121    -21
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -410
-11     -72     0       0
9       73      -15     71
-15     -74     -82     -41
24      68      -8      2
-13     -72     -54     -11
21      71      15      72
-33     -65     -94     -6
35      52      -5      6
92      -24     -50     23
4       -7      48      58
52      -22     -66     64
-64     -37     0       8
71      -62     -21     47
-3      -9      71      13
22      -49     -38     86
-75     -5      4       6
18      -90     4       52
-6      -7      69      -27
-9      -53     33      85
-59     43      7       3
-33     -90     40      38
-7      -2      35      -66
-37     -39     74      58
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -410
20      73      0       0
-29     -73     3       -76
38      62      111     10
-46     -61     12      -2
44      60      62      -40
-45     -57     -44     -61
52      57      98      -52
-55     -24     7       -7
-93     61      32      -66
-6      10      -70     -32
-34     66      40      -102
71      25      0       -10
-23     111     -8      -74
-2      10      -73     20
18      72      -32     -106
71      -23     -7      -10
34      108     -54     -52
6       10      -48     54
55      47      -81     -81
46      -59     -10     -5
93      63      -74     -11
8       4       -15     73
73      9       -104    -36
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -390
36      77      0       0
-19     -86     22      -83
29      81      -128    31
-35     -79     13      -3
37      80      88      -31
-44     -72     -36     -82
37      78      -128    -43
-46     -34     10      -9
-128    50      50      -78
-9      8       -82     -34
-53     81      82      -116
80      39      2       -12
-80     117     -5      -92
-2      12      -87     7
3       96      -14     -128
85      -15     -3      -12
9       -128    -52     -79
5       12      -60     61
63      68      -84     -118
61      -57     -10     -5
90      103     -92     -23
12      5       -22     82
91      18      -128    -57
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -390
63      -60     0       0
-66     58      -85     13
64      -57     -12     -128
-66     54      -10     -8
60      -67     -35     -89
-51     71      -57     68
50      -73     -98     -113
-14     61      -12     -1
123     88      -87     -41
11      -2      -8      86
77      47      -128    -53
8       -86     -10     6
-128    35      -92     -11
7       -9      43      73
88      -19     -128    51
-48     -79     -5      10
-128    -73     -79     47
4       -11     74      42
65      -64     -105    105
-82     -35     3       10
84      -123    -25     87
-3      -10     84      -10
27      -89     -13     -128
CTE[DF:51:35:BB:2D:FC (random)]: samples count 45, cte type AOD 2 [us], slot durations: 2 [us], packet status CRC OK, RSSI -430
50      -34     0       0
-50     34      -61     7
40      -43     -32     -128
-44     38      -6      -10
48      -36     -26     -79
-46     40      -43     43
43      -41     -99     -99
-19     43      -12     -2
117     67      -72     -41
12      -2      -11     57
78      37      -128    -23
14      -58     -9      5
-128    13      -81     15
9       -7      20      57
85      -13     -119    64
-30     -55     -7      11
116     -76     -63     53
3       -11     50      34
61      -59     -71     115
-53     -25     3       10
59      -122    -24     82
-6      -12     58      -1
17      -81     12      -128

The number of data printed at once seems to be limited.

This is my entire code of main.c:

RX:nrf\samples\bluetooth\direction_finding_central_main.c

/*
 * Copyright (c) 2022 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#include <zephyr/types.h>
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/logging/log.h>

#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/direction.h>
#include <zephyr/bluetooth/conn.h>

/* Latency set to zero, to enforce PDU exchange every connection event */
#define CONN_LATENCY 0U
/* Arbitrary selected timeout value */
#define CONN_TIMEOUT 400U
/* Inteval used to run CTE request procedure periodically.
 * Value is a number of connection events.
 */
#define CTE_REQ_INTERVAL (CONN_LATENCY + 10U)
/* Length of CTE in unit of 8 us */
#define CTE_LEN (0x14U)

#define DF_FEAT_ENABLED BIT64(BT_LE_FEAT_BIT_CONN_CTE_RESP)

static struct bt_conn *default_conn;
static const struct bt_le_conn_param conn_params = BT_LE_CONN_PARAM_INIT(
	BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MAX, CONN_LATENCY, CONN_TIMEOUT);

#if defined(CONFIG_BT_DF_CTE_RX_AOA)
/* Example sequence of antenna switch patterns for antenna matrix designed by
 * Nordic. For more information about antenna switch patterns see README.rst.
 */
static const uint8_t ant_patterns[] = { 0x0,0x1,0x2,0x3 };
#endif /* CONFIG_BT_DF_CTE_RX_AOA */

int IQ_data1[46]={};
int IQ_data2[46]={};
int IQ_data3[46]={};
int IQ_data4[46]={};

LOG_MODULE_REGISTER(Less4_Exer2,LOG_LEVEL_DBG);

static void start_scan(void);

static const char *cte_type2str(uint8_t type)
{
	switch (type) {
	case BT_DF_CTE_TYPE_AOA:
		return "AOA";
	case BT_DF_CTE_TYPE_AOD_1US:
		return "AOD 1 [us]";
	case BT_DF_CTE_TYPE_AOD_2US:
		return "AOD 2 [us]";
	default:
		return "Unknown";
	}
}

static const char *packet_status2str(uint8_t status)
{
	switch (status) {
	case BT_DF_CTE_CRC_OK:
		return "CRC OK";
	case BT_DF_CTE_CRC_ERR_CTE_BASED_TIME:
		return "CRC not OK, CTE Info OK";
	case BT_DF_CTE_CRC_ERR_CTE_BASED_OTHER:
		return "CRC not OK, Sampled other way";
	case BT_DF_CTE_INSUFFICIENT_RESOURCES:
		return "No resources";
	default:
		return "Unknown";
	}
}

static bool eir_found(struct bt_data *data, void *user_data)
{
	bt_addr_le_t *addr = user_data;
	uint64_t u64 = 0U;
	int err;

	printk("[AD]: %u data_len %u\n", data->type, data->data_len);

	switch (data->type) {
	case BT_DATA_LE_SUPPORTED_FEATURES:
		if (data->data_len > sizeof(u64)) {
			return true;
		}

		(void)memcpy(&u64, data->data, data->data_len);

		u64 = sys_le64_to_cpu(u64);

		if (!(u64 & DF_FEAT_ENABLED)) {
			return true;
		}

		err = bt_le_scan_stop();
		if (err) {
			printk("Stop LE scan failed (err %d)\n", err);
			return true;
		}

		err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, &conn_params, &default_conn);
		if (err) {
			printk("Create conn failed (err %d)\n", err);
			start_scan();
		}
		return false;
	}

	return true;
}

static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
			 struct net_buf_simple *ad)
{
	char dev[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(addr, dev, sizeof(dev));
	printk("[DEVICE]: %s, AD evt type %u, AD data len %u, RSSI %i\n", dev, type, ad->len, rssi);

	/* We're only interested in connectable events */
	if (type == BT_GAP_ADV_TYPE_ADV_IND || type == BT_GAP_ADV_TYPE_ADV_DIRECT_IND) {
		bt_data_parse(ad, eir_found, (void *)addr);
	}
}

static void enable_cte_reqest(void)
{
	int err;

	const struct bt_df_conn_cte_rx_param cte_rx_params = {
#if defined(CONFIG_BT_DF_CTE_RX_AOA)
		.cte_types = BT_DF_CTE_TYPE_ALL,
		.slot_durations = 0x2,
		.num_ant_ids = ARRAY_SIZE(ant_patterns),
		.ant_ids = ant_patterns,
#else
		.cte_types = BT_DF_CTE_TYPE_AOD_1US | BT_DF_CTE_TYPE_AOD_2US,
#endif /* CONFIG_BT_DF_CTE_RX_AOA */
	};

	const struct bt_df_conn_cte_req_params cte_req_params = {
		.interval = CTE_REQ_INTERVAL,
		.cte_length = CTE_LEN,
#if defined(CONFIG_BT_DF_CTE_RX_AOA)
		.cte_type = BT_DF_CTE_TYPE_AOA,
#else
		.cte_type = BT_DF_CTE_TYPE_AOD_2US,
#endif /* CONFIG_BT_DF_CTE_RX_AOA */
	};

	printk("Enable receiving of CTE...\n");
	err = bt_df_conn_cte_rx_enable(default_conn, &cte_rx_params);
	if (err) {
		printk("failed (err %d)\n", err);
		return;
	}
	printk("success. CTE receive enabled.\n");

	printk("Request CTE from peer device...\n");
	err = bt_df_conn_cte_req_enable(default_conn, &cte_req_params);
	if (err) {
		printk("failed (err %d)\n", err);
		return;
	}
	printk("success. CTE request enabled.\n");
}

static void start_scan(void)
{
	int err;

	/* Use active scanning and disable duplicate filtering to handle any
	 * devices that might update their advertising data at runtime.
	 */
	struct bt_le_scan_param scan_param = {
		.type = BT_LE_SCAN_TYPE_ACTIVE,
		.options = BT_LE_SCAN_OPT_NONE,
		.interval = BT_GAP_SCAN_FAST_INTERVAL,
		.window = BT_GAP_SCAN_FAST_WINDOW,
	};

	err = bt_le_scan_start(&scan_param, device_found);
	if (err) {
		printk("Scanning failed to start (err %d)\n", err);
		return;
	}

	printk("Scanning successfully started\n");
}

static void connected(struct bt_conn *conn, uint8_t conn_err)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	if (conn_err) {
		printk("Failed to connect to %s (%u)\n", addr, conn_err);

		bt_conn_unref(default_conn);
		default_conn = NULL;

		start_scan();
		return;
	}

	printk("Connected: %s\n", addr);

	if (conn == default_conn) {
		enable_cte_reqest();
	}
}

static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	printk("Disconnected: %s (reason 0x%02x)\n", addr, reason);

	if (default_conn != conn) {
		return;
	}

	bt_conn_unref(default_conn);
	default_conn = NULL;

	start_scan();
}

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("CTE[%s]: samples count %d, cte type %s, slot durations: %u [us], "
		       "packet status %s, RSSI %i\n",
		       addr, report->sample_count, cte_type2str(report->cte_type),
		       report->slot_durations, packet_status2str(report->packet_status),
		       report->rssi);

			/*for (uint8_t idx = 0; idx < report->sample_count; idx++) {
				if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) {
					printk(" IQ[%d]: %d, %d\n", idx, report->sample[idx].i,
					       report->sample[idx].q);
				} 
			}*/

			for (uint8_t idx = 0; idx < report->sample_count-22; idx++) {/*0-22之间*/
				if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) {
					IQ_data1[idx]=report->sample[idx].i;
					IQ_data2[idx]=report->sample[idx].q;		
				} 
			}

			for (uint8_t idx = report->sample_count-22; idx < report->sample_count; idx++) {/*23-44,它的22是0所以打印结果正确*/
				if (report->sample_type == BT_DF_IQ_SAMPLE_8_BITS_INT) {
					IQ_data3[idx]=report->sample[idx].i;
					IQ_data4[idx]=report->sample[idx].q;				
				} 
			}

			for(int i=0;i<=22;i++){
				printk("%d\t%d\t%d\t%d\n",IQ_data1[i],IQ_data2[i],IQ_data3[i+22],IQ_data4[i+22]);
			}
		
	} else {
		printk("CTE[%s]: request failed, err %u\n", addr, report->err);
	}
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
	.connected = connected,
	.disconnected = disconnected,
	.cte_report_cb = cte_recv_cb,
};

int main(void)
{
	int err;

	err = bt_enable(NULL);
	if (err) {
		printk("Bluetooth init failed (err %d)\n", err);
		return 0;
	}

	printk("Bluetooth initialized\n");

	start_scan();
	return 0;
}

TX:direction_finding_peripheral (AoD mode):

/*
 * Copyright (c) 2022 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#include <zephyr/types.h>
#include <errno.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/kernel.h>

#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/direction.h>

#define DF_FEAT_ENABLED BIT64(BT_LE_FEAT_BIT_CONN_CTE_RESP)

static const struct bt_data ad[] = {
	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
	BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_24_ENCODE(DF_FEAT_ENABLED)),
};

/* Latency set to zero, to enforce PDU exchange every connection event */
#define CONN_LATENCY 0U
/* Interval used to run CTE request procedure periodically.
 * Value is a number of connection events.
 */
#define CTE_REQ_INTERVAL (CONN_LATENCY + 10U)
/* Length of CTE in unit of 8 us */
#define CTE_LEN (0x14U)

#if defined(CONFIG_BT_DF_CTE_TX_AOD)
/* Example sequence of antenna switch patterns for antenna matrix designed by
 * Nordic. For more information about antenna switch patterns see README.rst.
 */
static uint8_t ant_patterns[] = {0x0,0x1,0x2,0x3};/*反了就是0x0,0x8,0x4,0x12即s1,s9,s5,s13*/
#endif /* CONFIG_BT_DF_CTE_TX_AOD */

static void enable_cte_response(struct bt_conn *conn)
{
	int err;

	const struct bt_df_conn_cte_tx_param cte_tx_params = {
#if defined(CONFIG_BT_DF_CTE_TX_AOD)
		.cte_types = BT_DF_CTE_TYPE_ALL,
		.num_ant_ids = ARRAY_SIZE(ant_patterns),
		.ant_ids = ant_patterns,
#else
		.cte_types = BT_DF_CTE_TYPE_AOA,
#endif /* CONFIG_BT_DF_CTE_TX_AOD */
	};

	printk("Set CTE transmission params...");
	err = bt_df_set_conn_cte_tx_param(conn, &cte_tx_params);
	if (err) {
		printk("failed (err %d)\n", err);
		return;
	}
	printk("success.\n");

	printk("Set CTE response enable...");
	err = bt_df_conn_cte_rsp_enable(conn);
	if (err) {
		printk("failed (err %d).\n", err);
		return;
	}
	printk("success.\n");
}

static void connected(struct bt_conn *conn, uint8_t err)
{
	if (err) {
		printk("Connection failed (err 0x%02x)\n", err);
	} else {
		printk("Connected\n");

		enable_cte_response(conn);
	}
}

static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	printk("Disconnected (reason 0x%02x)\n", reason);
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
	.connected = connected,
	.disconnected = disconnected,
};

static void bt_ready(void)
{
	int err;

	printk("Bluetooth initialized\n");

	err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
	if (err) {
		printk("Advertising failed to start (err %d)\n", err);
		return;
	}

	printk("Advertising successfully started\n");
}

int main(void)
{
	int err;

	err = bt_enable(NULL);
	if (err) {
		printk("Bluetooth init failed (err %d)\n", err);
		return 0;
	}

	bt_ready();

	return 0;
}

Thank you in advance!

Related