Hi all,
I am working with the new BLE_STACK 2.2.0 and I would like my slave device to be able to be connected with 2 master devices at the same time.
Is it possible? If yes how can I do it?
Thanks in advance,
Sylvain
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Philippe,
Did you succeed to connect to your 2 masters phone? I still can't do it on my side!
Thanks in advance
Sylvain
Hi Sylvain,
Yes, I managed to connect 2 masters phone to the CC2640 as peripheral.
1) In the stack file "build_config.opt", uncomment the V41_CTRL_CFG feature
2) set the MAX_NUM_BLE_CONNS to 2 in the predefined preprocessor symbols
3) Then most of the work is related to the gapRole implementation (file "peripheral.c"). The one delivered with the simple-peripheral example is really not compatible with a multi-master set-up but I managed to make it "pretty much work" with only a few modifications, though I suspect a lot more work has to be done to improve stability.
Since then I made more modifications specific to my use-case, so I will try to remember only the relevant ones :
- in function GAPRole_SetParameter(...) , case GAPROLE_ADVERT_ENABLED: change the condition for calling gapRole_setEvent(START_ADVERTISING_EVT), instead, compare linkDB_NumActive() with MAX_NUM_BLE_CONNS
- in function gapRole_processGAPMsg(...) , case GAP_LINK_ESTABLISHED_EVENT: re-enable the advertising by calling to GAPRole_setParameter(GAPROLE_ADVERT_ENABLE,...)
- in function GAPRole_sendUpdateParam(...), do not return bleNotConnected if gapRole_state is GAPROLE_CONNECTED_ADV
I found these modifications by comparing with the multirole example, which is indeed better adapted to multiconnections. It would be great if TI could deliver a BLE stack "developper's guide" documentation based on this example.
Hi Philippe,
I tried your solution and it does work, but I couldn't do everything I wanted to do then I started again with my application but I switch from peripheral.c to multi.c in the profiles, here's how I did it.
In the stack, in build_config.opt :
-DHOST_CONFIG=PERIPHERAL_CFG must be the only one left in BLE Host Build Configurations
-DBLE_V41_FEATURES=V41_CTRL_CFG must also be uncomment
In the app :
In the preprocessor options add MAX_NUM_BLE_CONNS=x , with x the number of max connections you want.
- Then replace peripheral.c and .h with multi.c and multi.h ( you then have to change all the corresponding includes..
- In multi.c, gapRole_init(void), you need to comment GAP_PROFILE_CENTRAL and leave only
- Dans multi.c, gapRole_init(void) il faut enlever GAP_PROFILE_CENTRAL et ne laisser que GAP_PROFILE_PERIPHERAL for the gapRole_profileRole
- Then it is dependant of your application but the GAPROLE states are less accurate you should prefer linkDB_NumActive() that indicates the number of active connections
- Finally in most of the GAP function calls you need to add the corresponding connHandle
I hope this will help some of you!