2022-05-11 01:52 AM
Hello guys,
I want connect to a bluetooth device/beacon from STM32WB.
I've used this function to setup the connection with the device found when scanning but it won't connect to it it always print out "[BLE] Successfully Connected to Slave" and then directly"[BLE] Connection To Slave Failed"
static void vConnectionRequest(eAppBleConnectionStatus __e_NewStatus)
{ tBleStatus result;
vCNSLCTRL_SendDataToOuput(true,"[BLE] Successfully Connected to Slave\r\n");
if (_t_BleApplicationContext.e_DeviceConnectionStatus != APP_BLE_CONNECTED_CLIENT)
{
result = aci_gap_create_connection(0x4000, 0x4000, PUBLIC_ADDR, _au8_ScannedMacAddress, PUBLIC_ADDR, 40, 40, 0, 60, 2000 , 2000);
if (result == BLE_STATUS_SUCCESS)
{
_t_BleApplicationContext.e_DeviceConnectionStatus = APP_BLE_LP_CONNECTING;
}
else
{
vCNSLCTRL_SendDataToOuput(true,"[BLE] Connection To Slave Failed \r\n");
}
}
Did i do something wrong here?
2022-05-11 03:14 AM
A "Beacon" usually means something that does not accept connections.
Are you sure that your "device" does actually allow connections?
2022-05-11 03:24 AM
Yes, it is a Bluetooth sensor it advertises data like a beacon it's connectable so that the user can configure it (time of advertisment, data type ...)
this is his scanned data:
[BLE] MAC : [DD]:[34]:[02]:[07]:[54]:[E0] RSSI= -89
[BLE] ADV_FRAME= 2 1 6 3 3 aa fe 12 16 aa fe 21 1 f e 7 1a d 29 e 0 5 ff f2 3 f3 a7 5d 93 6e
[BLE] Frame_Type= 0x21 : Kbeacon
[BLE] Vbatt = 3591mV Temp = 26.5 C Hum = 41.5% X:5;Y:-14;Z:1011
2022-05-11 04:17 AM
Does it need to be in a special "configuration" mode to accept that connection?
Are you sure you have all the connections parameters correct?
Can you connect to it using other devices?
Have you contacted the device manufacturer for support?
2022-05-11 04:38 AM
No it does not need a special configuration to connect, in fact i can connect to it using any android beacon app so it is connectable.
Are you sure you have all the connections parameters correct? : I don't know about that i've copied the same parameters from p2p_client example i don't know does it have to change when connecting to other devices other then stm32wb ?
2022-05-11 04:54 AM
"i can connect (sic) to it using any android beacon app"
Are you sure that actually establishes a connection?
Again, a "beacon" is generally something that does not connect, so a "beacon" app is likely just listening for the broadcast advertisements - not connecting?
You're going to have to contact the device manufacturer to find what settings it needs to connect.
2022-05-11 05:02 AM
There it is, it is connected like any other device and i can manipulate it's configurations
2022-05-18 02:53 AM
Hello,
Can you check if your two devices used public address and the mac address of the device used in aci_gap_create_connection command ?
Maybe you can try to use parameters used in BLE_p2pClient for aci_gap_create_connection command.
Best Regards