2021-09-09 02:19 AM
Hi there,
In short I am trying to use the Nucleo-68 board to scan for Cadence Sensor devices with UUID 0x1816 which I've managed successfully. I get a list of all available devices and their addresses (double checked against a report generated through my phone). However the issue arises when I issue a connect request - I do get a BLE_STATUS_SUCCESS (Green LED on) but the event callback hci_le_connection_complete_event() is never actually called because the Blue LED never turns on.
// Snippet of Connect_Request()
if (result == BLE_STATUS_SUCCESS) {
/* USER CODE BEGIN BLE_CONNECT_SUCCESS */
HAL_GPIO_WritePin(LED_GREEN_GPIO_Port, LED_GREEN_Pin, GPIO_PIN_SET);
/* USER CODE END BLE_CONNECT_SUCCESS */
BleApplicationContext.Device_Connection_Status =
APP_BLE_LP_CONNECTING;
} else {
/* USER CODE BEGIN BLE_CONNECT_FAILED */
HAL_GPIO_WritePin(LED_RED_GPIO_Port, LED_RED_Pin, GPIO_PIN_SET);
/* USER CODE END BLE_CONNECT_FAILED */
BleApplicationContext.Device_Connection_Status = APP_BLE_IDLE;
}
//Snippet of SVCCTL_App_Notification()
case HCI_LE_META_EVT_CODE: {
/* USER CODE BEGIN EVT_LE_META_EVENT */
/* USER CODE END EVT_LE_META_EVENT */
meta_evt = (evt_le_meta_event*) event_pckt->data;
switch (meta_evt->subevent) {
/* USER CODE BEGIN subevent */
/* USER CODE END subevent */
case HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE:
/* USER CODE BEGIN EVT_LE_CONN_COMPLETE */
HAL_GPIO_WritePin(LED_BLUE_GPIO_Port, LED_BLUE_Pin, GPIO_PIN_SET);
/* USER CODE END EVT_LE_CONN_COMPLETE */
/**
* The connection is done,
*/
What could be causing this? I wouldn't even know what code is actually relevant - the sheer amount of WPAN files is overwhelming and difficult to follow for a STM32WB newbie like myself.
Many thanks,
Jakub
2021-09-09 02:22 AM
I have noticed that aci_gap_create_connection() can take a garbage MAC address and still return BLE_STATUS_SUCCESS, so I suppose that flag simply indicates that all went well on the STM32 side and it is now trying to connect to some peripheral.
I have played a bit with the connection parameters as well, read the Bluetooth SIG for CSCP but to no avail.