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.
I try to use TI BLE 1.2.1, SimpleBLECentral Sample Project on EM Borad to connect 2 keyfob ( mini dk ),
When I connect to 1 keyfob successed and try to connect to another keyfob, it always fail.
And i found pEvent->gap.hdr.status shows 0x3B in simpleBLECentral.c (as below code)
If any one could tell me where can i check the value of pEvent->gap.hdr.status means?
simpleBLECentral.c
case GAP_LINK_ESTABLISHED_EVENT:
{
if ( pEvent->gap.hdr.status == SUCCESS )
{
simpleBLEState = BLE_STATE_CONNECTED;
simpleBLEConnHandle = pEvent->linkCmpl.connectionHandle;
simpleBLEProcedureInProgress = TRUE;
// If service discovery not performed initiate service discovery
if ( simpleBLECharHdl == 0 )
{
osal_start_timerEx( simpleBLETaskId, START_DISCOVERY_EVT, DEFAULT_SVC_DISCOVERY_DELAY );
}
LCD_WRITE_STRING( "Connected", HAL_LCD_LINE_1 );
LCD_WRITE_STRING( bdAddr2Str( pEvent->linkCmpl.devAddr ), HAL_LCD_LINE_2 );
}
else
{
simpleBLEState = BLE_STATE_IDLE;
simpleBLEConnHandle = GAP_CONNHANDLE_INIT;
simpleBLERssi = FALSE;
simpleBLEDiscState = BLE_DISC_STATE_IDLE;
LCD_WRITE_STRING( "Connect Failed", HAL_LCD_LINE_1 );
LCD_WRITE_STRING_VALUE( "Reason:", pEvent->gap.hdr.status, 10, HAL_LCD_LINE_2 );
}
}
break;
George,
Same with me (only in my case OSAL event had.status is 0x21).
I've had no luck trying to find any clue in BLE API Guide (unfortunately, it is just doxy piece, with little additional info. Cost-effective, TI).
ed: I forgot - try to set GAPCentralRole_EstablishLink calls (or generally attempts to establish links) apart temporally. E.g. if you've just switched roles/started role and try to connect right away, it almost often fails. If your application allows it, postpone the attempt for 1 second for beginning and check out what happens.
Hi,
Error code 0x3B is "Unacceptable Connection Interval", please refer to the BLEv1.1 release notes:
Error code 0x21 is "Unexpected State Role"..
Best Regards
Hi, Nick
Thanks for the answer!
May I ask - what kind of delay should be put between role switch and first attempt to establish link?
In one of my devices, I do following:
1. Upon certain event, switch from Peripheral Role (PR for short) to Central Role (CR).
2. Try to establish link with PR device (the address is known).
(The basic role switching code is ripped from MasterSlaveSwitch)
The trouble is that I've failed to catch the moment when I could establish link. Just catching GAP_DEVICE_INIT_DONE_EVENT does not cut it - establishing links fails repeatedly (I typically do 16 attempts that consists of calling GAP_CentraRoleEsablishLink, setting 50 unit timer and checking for ESABLISH_LINK event, if the latter is not successful, rinse and repeat). However, setting e.g. 500 unit timer and trying to establish link afterwards works reliably.
I remember that there were posts discussing same issue, and it was consensus that certain delay should be put between starting the role and establishing link, but the delay discussed was much smaller (like 100 units, doesnt work for me).
Thanks,
Oleg