2025-03-11 6:20 AM
I have my device that is working on FreeRTOS. The main issue is that when I connect my device to an app (a custom or the ST BLE toolbox), I kill the app. If I relaunch the app, the device is not shown.
To check why it causes this issue, I check if my device is connected to the phone, for example, to try to relaunch the advertising.
But then I saw that my device stayed at BLE APP_BLE_FAST_ADV even if I was connected.
I also checked at two places if I am connected.
in custom_app.c in this function :
void Custom_APP_Notification(Custom_App_ConnHandle_Not_evt_t* pNotification) { /* USER CODE BEGIN CUSTOM_APP_Notification_1 */ /* USER CODE END CUSTOM_APP_Notification_1 */ switch (pNotification->Custom_Evt_Opcode) { /* USER CODE BEGIN CUSTOM_APP_Notification_Custom_Evt_Opcode */ /* USER CODE END P2PS_CUSTOM_Notification_Custom_Evt_Opcode */ case CUSTOM_CONN_HANDLE_EVT: /* USER CODE BEGIN CUSTOM_CONN_HANDLE_EVT */ /* USER CODE END CUSTOM_CONN_HANDLE_EVT */ break; case CUSTOM_DISCON_HANDLE_EVT: /* USER CODE BEGIN CUSTOM_DISCON_HANDLE_EVT */ /* USER CODE END CUSTOM_DISCON_HANDLE_EVT */ break;
and in app_ble.c in this function :
SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* p_Pckt) { p_event_pckt = (hci_event_pckt*)((hci_uart_pckt*)p_Pckt)->data; switch (p_event_pckt->evt) { case HCI_DISCONNECTION_COMPLETE_EVT_CODE: { break; } case HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE: { break; } } }
In both cases, I never go to this function even if I am connected to the device it sends data through notify.
4 months ago, when I was working with the stm32 sequencer for the Bluetooth, the first function was working and correctly broke when I connected the device to the phone (I checkout to the branch to check)
Environment :
Do you have an idea of what can cause the issue?
Thanks in advance
2025-03-11 6:28 AM
When a connection is established, your STM32 should store the connection handle. If not, it might be an issue with aci_gap_set_event_mask(). Check if
aci_gap_set_event_mask(GAP_EVT_MASK_ALL);
is set correctly in your BLE initialization.
2025-03-11 6:43 AM
The function
aci_gap_set_event_mask
Does correctly exist but
GAP_EVT_MASK_ALL
do not exist. I try to put 0xFFFF, 0x0002, 0x0020 in MX_APPE_Init, but it goes directly to the error Handler in the function. Moreover, the function aci_gap_set_event_mask is never call