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.

process passcode in Peripheral



I have tried to set up the passcode for peripheral side, but the problem is the Pairing process -  the connection still Success without Security Settup for Central side or the Wrong passcode. I want to find out which Function or event which Peripheral side use to process the Correct or not of Passcode from Central, or at least i can terminate the connection when the Passkey is not sent!

  • Hi,

    If the passcode entered is not correct, you should get a callback on the peripheral side with status:

    SMP_PAIRING_FAILED_PASSKEY_ENTRY_FAILED (0x01)

    See SDG VI.3.2 Pairing State callback (pairStateCB)

    See glucoseSensor project for example:

    static void glucosePairStateCB( uint16 connHandle, uint8 state, uint8 status )
    {
      if ( state == GAPBOND_PAIRING_STATE_COMPLETE )
      {
        if ( status == SUCCESS )
        {

    ...

    Best wishes

  • Ihave tried your way but i stilll not work,
    i see that your way is the same with the Setup Security for central side! and i am setting up for peripheral side? Or i have wrong?
    My purpose is disconnect the device which do not send the passcode to Peripheral in Connection Process!
    HElp me please!
  • Hi, which version of BLE stack are you using? The previous code was relevant if the user input the wrong passcode on the central side. Can you check if you are getting the GAPBOND_PAIRING_STATE_COMPLETE or GAPBOND_PAIRING_STATE_STARTED in the pairing callbacks?

    Best wishes
  • I am using devpack to debug for two of them. So, all of result i will receive through Uart interface, and the passcode will be sent in the same time with the connection process.
    While the slave i set up the security wwith pass code. The central will be set no paring and no bonding,..... When i send the command for connection, the slave do not terminate the connection when the central do not send the passcode in connection process.
    Slave side, i set up wwait for request....
    I also know to set up for termination wwhen cen tral send wrong passcode. But the problem above still not yet.