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.

cc254x + passcode

Other Parts Discussed in Thread: CC2541, BLE-STACK

Hello everybody, I'm try to use cc2541 with passcode and playing with this code

// Setup the GAP Bond Manager
  {
    uint32 passkey = 0x01020304; // passkey "000000"
    uint8 pairMode = GAPBOND_PAIRING_MODE_INITIATE;//GAPBOND_PAIRING_MODE_WAIT_FOR_REQ
    uint8 mitm = TRUE;
    uint8 ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
    uint8 bonding = TRUE;
    uint8 key_size = 4;
    GAPBondMgr_SetParameter( GAPBOND_DEFAULT_PASSCODE, sizeof ( uint32 ), &passkey );
    GAPBondMgr_SetParameter( GAPBOND_PAIRING_MODE, sizeof ( uint8 ), &pairMode );
    GAPBondMgr_SetParameter( GAPBOND_MITM_PROTECTION, sizeof ( uint8 ), &mitm );
    GAPBondMgr_SetParameter( GAPBOND_IO_CAPABILITIES, sizeof ( uint8 ), &ioCap );
    GAPBondMgr_SetParameter( GAPBOND_BONDING_ENABLED, sizeof ( uint8 ), &bonding );
    GAPBondMgr_SetParameter( GAPBOND_KEYSIZE, sizeof( uint8), &key_size );
  }

The best result - "TI Device Monitor" (android version) - ask me a code, but other app such as LightBlue (iPhone) and my own app (iPhone) can connect and read/write data without authorization.

Once time I catch  a passcode request in LigthBlue  and connect using code 01020304 and then using 0 - but after once time passing I can't repeat same request (even restart app and cc2541).

Please help me - what I do wrong?

  • Hello Denis,

    I recommend that you review the 5.3 Gap Bond Manager section of the SW Dev Guide in the BLE-Stack SDK. Since you are doing iOS programming, you also need to be familiar with the Apple Bluetooth Accessory Design Guide, specifically as it relates to Pairing. You can find this guide on the Apple BT dev portal: developer.apple.com/.../

    Note that the passkey is a six digit decimal value in the range of 000000 - 999999. I also don't recommend you change the key_size from the default value.

    Best wishes