2025-12-13 5:42 PM
Hi,
I’m porting the DATALOG2 application from
fp-sns-datalog2\STM32CubeFunctionPack_DATALOG2_V3.1.0\Projects\STM32U585AI-STWIN.box\Applications\DATALOG2to the STM32U575VGT6, but I’m running into issues with the Bluetooth functionality during debugging. Does anyone have any suggestions?
The code enters this section:
if (ret_status != (ble_status_t)BLE_STATUS_SUCCESS)
{
BLE_MANAGER_PRINTF("Error: HCI_LE_SET_SCAN_RESPONSE_DATA [%x]\r\n", ret_status);
goto end_label;
}
I can erase, read, and program the BLUENRG-M2SA using RF-Flasher Utility v4.5.0, which indicates that the chip is not damaged.
The complete project source code is attached.
The hardware circuit is as follows:
The code is as follows:
void set_connectable_ble(void)
{
#if (BLUE_CORE == BLUENRG_MS)
char local_name[8] = {AD_TYPE_COMPLETE_LOCAL_NAME,
#else /* (BLUE_CORE == BLUENRG_MS) */
uint8_t local_name[8] = {AD_TYPE_COMPLETE_LOCAL_NAME,
#endif /* (BLUE_CORE == BLUENRG_MS) */
ble_stack_value.board_name[0],
ble_stack_value.board_name[1],
ble_stack_value.board_name[2],
ble_stack_value.board_name[3],
ble_stack_value.board_name[4],
ble_stack_value.board_name[5],
ble_stack_value.board_name[6]
};
ble_status_t ret_status = BLE_STATUS_SUCCESS;
/* disable scan response */
#if (BLUE_CORE == BLUENRG_MS)
ret_status = HCI_LE_SET_SCAN_RESPONSE_DATA(0U, NULL);
#else /* (BLUE_CORE == BLUENRG_MS) */
ret_status = hci_le_set_scan_response_data(0U, NULL);
#endif /* (BLUE_CORE == BLUENRG_MS) */
if (ret_status != (ble_status_t)BLE_STATUS_SUCCESS)
{
BLE_MANAGER_PRINTF("Error: HCI_LE_SET_SCAN_RESPONSE_DATA [%x]\r\n", ret_status);
goto end_label;
}
/* Set the board discoverable */
if (ble_stack_value.advertising_filter == ((uint8_t)NO_WHITE_LIST_USE))
{
ret_status = aci_gap_set_discoverable(ADV_IND, ble_stack_value.adv_interval_min, ble_stack_value.adv_interval_max,
ble_stack_value.own_address_type,
ble_stack_value.advertising_filter,
(uint8_t)(sizeof(local_name)), local_name, 0, NULL, 0, 0);
if (ret_status != (ble_status_t)BLE_STATUS_SUCCESS)
{
BLE_MANAGER_PRINTF("Error: aci_gap_set_discoverable [%x] Filter=%x\r\n",
ret_status, ble_stack_value.advertising_filter);
goto end_label;
}
else
{
#if (BLE_DEBUG_LEVEL>1)
BLE_MANAGER_PRINTF("aci_gap_set_discoverable OK Filter=%x\r\n", ble_stack_value.advertising_filter);
#endif /* (BLE_DEBUG_LEVEL>1) */
}
}
else
{
/* Advertising filter is enabled: enter in undirected connectable mode
in order to use the advertising filter on bonded device */
#if (BLUE_CORE == BLUENRG_MS)
ret_status = aci_gap_set_undirected_connectable(ble_stack_value.own_address_type,
ble_stack_value.advertising_filter);
#else /* (BLUE_CORE == BLUENRG_MS) */
ret_status = aci_gap_set_undirected_connectable(0,
0,
ble_stack_value.own_address_type,
ble_stack_value.advertising_filter);
#endif /* (BLUE_CORE == BLUENRG_MS) */
if (ret_status != (ble_status_t)BLE_STATUS_SUCCESS)
{
BLE_MANAGER_PRINTF("Error: aci_gap_set_undirected_connectable [%x] Filter=%x\r\n", ret_status,
ble_stack_value.advertising_filter);
goto end_label;
}
else
{
#if (BLE_DEBUG_LEVEL>1)
BLE_MANAGER_PRINTF("aci_gap_set_undirected_connectable OK Filter=%x\r\n", ble_stack_value.advertising_filter);
#endif /* (BLE_DEBUG_LEVEL>1) */
}
}
update_adv_data();
end_label:
return;
}
#else /* ((BLUE_CORE != BLUENRG_LP) && (BLUE_CORE != STM32WB07_06) && (BLUE_CORE != STM32WB05N)) */
#if (BLUE_CORE == STM32WB05N)
2025-12-13 5:58 PM
my PCB layout is as following, does it led to the above question?
2025-12-13 10:51 PM
This error usually means the BLE stack isn’t fully initialized or the HCI transport isn’t ready when HCI_LE_SET_SCAN_RESPONSE_DATA() is called.
Things to check first:
Since RF-Flasher works, the chip is fine — this is almost always a host–BLE interface or init sequence issue, not hardware damage.