cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to beacon from STM32WB

BLiwa.1
Associate II

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?

7 REPLIES 7

A "Beacon" usually means something that does not accept connections.

Are you sure that your "device" does actually allow connections?

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

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?

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 ?

"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.

0693W00000NplwVQAR.jpg0693W00000NplwQQAR.jpgThere it is, it is connected like any other device and i can manipulate it's configurations

Remy ISSALYS
ST Employee

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