Hi hobbya, I will try your sketch from now on.
Here are my findings for today.
To make it easier to distinguish, two data data1 and data2 were defined and sent on the advertise and scan response. When checked by the mobile app, 55 bytes were received, including 2 bytes of CID. However, XIAO Central could only receive data1 on the advertise. The conclusion is that there is a problem with Central.
uint8_t data1[] = { 0xFF, 0xFF, // CID 2
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, // data 24
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20,
0x21, 0x22, 0x23, 0x24};
uint8_t data2[] = { 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xB0, // data 29
0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xC0,
0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9};
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit.Advertising.setType(BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED);
Bluefruit.Advertising.addData(BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA, data1, sizeof(data1));
Bluefruit.Advertising.addTxPower();
Bluefruit.ScanResponse.addData(BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA, data2, sizeof(data2));
Bluefruit.Advertising.restartOnDisconnect(true);
Bluefruit.Advertising.setIntervalMS(100, 100); // fast mode 100mS, slow mode 100mS
Bluefruit.Advertising.setFastTimeout(1); // fast mode 1 sec
Bluefruit.Advertising.start(1); // stop advertising after 1 sec, fast 1 sec slow 0 sec
So I read ble_gap.h and found the area of concern. I will continue to investigate a little further.
l\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.1\cores\nRF5\nordic\softdevice\s140_nrf52_7.3.0_API\include\ble_gap.h:709 and 1278
/**@brief Advertising report type. */
typedef struct
{
uint16_t connectable : 1; /**< Connectable advertising event type. */
uint16_t scannable : 1; /**< Scannable advertising event type. */
uint16_t directed : 1; /**< Directed advertising event type. */
uint16_t scan_response : 1; /**< Received a scan response. */
uint16_t extended_pdu : 1; /**< Received an extended advertising set. */
uint16_t status : 2; /**< Data status. See @ref BLE_GAP_ADV_DATA_STATUS. */
uint16_t reserved : 9; /**< Reserved for future use. */
} ble_gap_adv_report_type_t;
/**@brief Event structure for @ref BLE_GAP_EVT_ADV_REPORT.
*
* @note If @ref ble_gap_adv_report_type_t::status is set to @ref BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA,
* not all fields in the advertising report may be available.
*
* @note When ble_gap_adv_report_type_t::status is not set to @ref BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA,
* scanning will be paused. To continue scanning, call @ref sd_ble_gap_scan_start.
*/
typedef struct
{
ble_gap_adv_report_type_t type; /**< Advertising report type. See @ref ble_gap_adv_report_type_t. */
ble_gap_addr_t peer_addr; /**< Bluetooth address of the peer device. If the peer_addr is resolved:
@ref ble_gap_addr_t::addr_id_peer is set to 1 and the address is the
peer's identity address. */
ble_gap_addr_t direct_addr; /**< Contains the target address of the advertising event if
@ref ble_gap_adv_report_type_t::directed is set to 1. If the
SoftDevice was able to resolve the address,
@ref ble_gap_addr_t::addr_id_peer is set to 1 and the direct_addr
contains the local identity address. If the target address of the
advertising event is @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE,
and the SoftDevice was unable to resolve it, the application may try
to resolve this address to find out if the advertising event was
directed to us. */
uint8_t primary_phy; /**< Indicates the PHY on which the primary advertising packet was received.
See @ref BLE_GAP_PHYS. */
uint8_t secondary_phy; /**< Indicates the PHY on which the secondary advertising packet was received.
See @ref BLE_GAP_PHYS. This field is set to @ref BLE_GAP_PHY_NOT_SET if no packets
were received on a secondary advertising channel. */
int8_t tx_power; /**< TX Power reported by the advertiser in the last packet header received.
This field is set to @ref BLE_GAP_POWER_LEVEL_INVALID if the
last received packet did not contain the Tx Power field.
@note TX Power is only included in extended advertising packets. */
int8_t rssi; /**< Received Signal Strength Indication in dBm of the last packet received.
@note ERRATA-153 and ERRATA-225 require the rssi sample to be compensated based on a temperature measurement. */
uint8_t ch_index; /**< Channel Index on which the last advertising packet is received (0-39). */
uint8_t set_id; /**< Set ID of the received advertising data. Set ID is not present
if set to @ref BLE_GAP_ADV_REPORT_SET_ID_NOT_AVAILABLE. */
uint16_t data_id:12; /**< The advertising data ID of the received advertising data. Data ID
is not present if @ref ble_gap_evt_adv_report_t::set_id is set to
@ref BLE_GAP_ADV_REPORT_SET_ID_NOT_AVAILABLE. */
ble_data_t data; /**< Received advertising or scan response data. If
@ref ble_gap_adv_report_type_t::status is not set to
@ref BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA, the data buffer provided
in @ref sd_ble_gap_scan_start is now released. */
ble_gap_aux_pointer_t aux_pointer; /**< The offset and PHY of the next advertising packet in this extended advertising
event. @note This field is only set if @ref ble_gap_adv_report_type_t::status
is set to @ref BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA. */
} ble_gap_evt_adv_report_t;