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.

URGENT : Just works Pairing doesn't work !!!! Please help

Other Parts Discussed in Thread: BLE-STACK

test_noBond_MasterInitiate.psd

I want to do "just works" pairing with bonding but i didn't even arrive to do "just works" without bonding.

Central :  Soft used : SimpleBLEcentral with this configuration :

uint8 pairMode = GAPBOND_PAIRING_MODE_INITIATE;
uint8 mitm = FALSE;
uint8 ioCap = GAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT;
uint8 bonding = FALSE;

Peripheral: used sof : KeyFob with this configuration :

uint8 pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
uint8 mitm = FALSE;
uint8 ioCap = GAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT;
uint8 bonding = FALSE;

The problem , is that , there is no Sexurity enabled; or encryption starting. Please can you help me ? what is the problem ?

first picture is this one : start connection+ start pairing




Second picture : pairing failed, no security enabled 

  • The error response you are pointing to does not relate to pairing at all. It is the response to the previous ATT_Find_By_Type_Value_Req. Can you attach the entire sniffer capture?
  • In addition, please specify the version of the TI BLE-Stack SDK you used.

    Best wishes
  • Ok, understood, maybe because there is discrovery of a characteristic that doesn't exist in the peripheral side. But , why there is no encryption ? i must see security enabled in the packets . i don't know how attach , but there is no difference, that 's exactly waht in the pictures. and i finished sniffing after it , because they are the same packets after that
  • i'm using the soft i found in BLE-CC254x-1.4.2.2 when i installed a TI tool ( i don't know what is it) . it added a directory on c/ texas instruments
  • i attached it Tim C. Any idea ?
  • Hi. I don't see the capture anywhere?

  • i attached it after your comment . look at my post, on the top
  • Ok I see it. Are you sure that you are actually using the variables that you are setting? That is, you should see these variables used with their respective GAPBondMgr parameter, such as:

    uint8 bonding = FALSE;
    GAPBondMgr_SetParameter( GAPBOND_BONDING_ENABLED, sizeof( uint8 ), &bonding );

    In any case, I just tested this using the parameters you have and the devices pair successfully. Here is the capture: 

    /cfs-file/__key/communityserver-discussions-components-files/538/pairing-example.psd

    I don't know what is different in your environment so I would recommend reinstalling the stack and trying again: www.ti.com/blestack

  • Yes they are set all.   i have GAPBondMgr_SetParameter for each parameter. like in the simpleBlecentral, it's the same code i just modified the flags  to have "just works" pairing.
     I see that the difference is only for you it starts the encryption and for me it's not  .  That may be what??  How can be a difference in the stack, ? i took the project from the same directory, . I mean the keyfob example and the simpleBLEcentral are both taken from the same version . When i downloded one of the tools it came with it under "C:\Texas Instruments\BLE-CC254x-1.4.2.2\Projects\ble"
    Any idea ?   

  • No I have no idea but the fact that mine works with a fresh stack install means you must have modified something. Please delete and reinstall the stack.

  • Ok , then i ll try to followw you instructions and give feedback . cya
  • I came back to the original project and it works , you're right.
    In fact in my project i modified some, i cancelled the Key prcoess, and i did an automatic process: scan-> if there is a device connect to it -> discovery sercvices. if there is no device , the system rescan . I think it's related to something, like timers, in fact i used "osal_start_timerEx()" and so i needed to activate timer on the project->options ->preprocessor. Do you think it's related to that . here is all the configuration of the preprocessor :
    INT_HEAP_LEN=3072
    HALNODEBUG
    OSAL_CBTIMER_NUM_TASKS=2 ( this it was =1 i changed it to 2 and it didn't work)
    HAL_AES_DMA=TRUE
    HAL_DMA=TRUE
    HAL_LED=FALSE
    HAL_KEY=FALSE
    HAL_TIMER=TRUE
    HAL_LCD=FALSE

    This is a aprt of the code for the automatic process, it's easy, i just added the event "START_PROCESS_EVT" to start the scanning and it's after START_DEVICE_EVT. Here is a part of what i did :


    uint16 SimpleBLECentral_ProcessEvent( uint8 task_id, uint16 events )
    {

    VOID task_id; // OSAL required parameter that isn't used in this function

    if ( events & SYS_EVENT_MSG )
    {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( simpleBLETaskId )) != NULL )
    {
    simpleBLECentral_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

    // Release the OSAL message
    VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
    }

    if ( events & START_DEVICE_EVT )
    {
    // Start the Device
    VOID GAPCentralRole_StartDevice( (gapCentralRoleCB_t *) &simpleBLERoleCB );

    // Register with bond manager after starting device
    GAPBondMgr_Register( (gapBondCBs_t *) &simpleBLEBondCB );

    //start the system process in 2s
    osal_start_timerEx( simpleBLETaskId, START_PROCESS_EVT, 2000);
    return ( events ^ START_DEVICE_EVT );
    }

    if ( events & START_DISCOVERY_EVT )
    {
    simpleBLECentralStartDiscovery( );

    return ( events ^ START_DISCOVERY_EVT );
    }


    if ( events & SBP_CONN_TIMEOUT_EVT) // i added this to avoid the case when i try to connect and the device in no treachable any more
    {
    // a connection establishement error
    GAP_TerminateLinkReq( simpleBLETaskId, 0xFFFE, 0 ); // cancel the pending connection request
    simpleBLEState = BLE_STATE_IDLE;
    simpleBLEConnHandle = GAP_CONNHANDLE_INIT;
    simpleBLERssi = FALSE;
    simpleBLEDiscState = BLE_DISC_STATE_IDLE;
    simpleBLECharHdl = 0;
    simpleBLEProcedureInProgress = FALSE;
    // restart scanning again
    simpleBLECentral_HandleKeys(TRUE,HAL_KEY_UP);

    return ( events ^ SBP_CONN_TIMEOUT_EVT);

    }
    if ( events & START_PROCESS_EVT) // this added to start the automatic process : scan ->connection if there is a device ...
    {
    //start scan for devices
    simpleBLECentral_HandleKeys(TRUE,HAL_KEY_UP);

    return ( events ^ START_PROCESS_EVT);
    }

    // Discard unknown events
    return 0;
    }
  • Ok, i find the problem. It's not related to the stack it a mistake in the code. When i implemented my process, i forget to add an "else" :
    case GAP_DEVICE_DISCOVERY_EVENT:
    {
    // discovery complete
    simpleBLEScanning = FALSE;

    // if not filtering device discovery results based on service UUID
    if ( DEFAULT_DEV_DISC_BY_SVC_UUID == FALSE )
    {
    // Copy results
    simpleBLEScanRes = pEvent->discCmpl.numDevs;
    osal_memcpy( simpleBLEDevList, pEvent->discCmpl.pDevList,
    (sizeof( gapDevRec_t ) * pEvent->discCmpl.numDevs) );
    }

    /*LCD_WRITE_STRING_VALUE( "Devices Found", simpleBLEScanRes,
    10, HAL_LCD_LINE_1 );*/
    if ( simpleBLEScanRes > 0 )
    {
    //start connection process
    simpleBLECentral_HandleKeys(TRUE,HAL_KEY_CENTER);
    }

    // initialize scan index to last device
    //simpleBLEScanIdx = simpleBLEScanRes;

    // restart scanning process
    simpleBLECentral_HandleKeys(TRUE,HAL_KEY_UP); ====================> here an "else" is missed
    }
    break;

    What i wanted is to restart scan in case there is no device found, so that means "else=if simpleBLEScanRes ==0" . Here so i retart scan after i establish link connection..it made a confusion to the system. I hope that helps the readers and guys may face such a problem.

    Thanks for you guys for help.