This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LESC numeric comparison pairing PIN generation

Hello. I need to use LESC numeric comparison pairing. It seems that the PIN is automatically and ramdomly generated after the connection occurs. I would need to manage or generate by myself the PIN generation, because I need to know it with enoug time to display it prior to send it to the other peer. This is because the other peer (smartphone) has a little time out to ingress the numeric PIN, so I need to know it after the connection. Any ideas? Thanks in advance.

  • Hi Jemajuca,

    How did you test ? Have you tried with ble_app_multirole_lesc example ?

    It should give the phone at least 30 seconds. I'm not sure why you said "as a little time out to ingress the numeric PIN" how long was that ?

    Note that there is a bug in the example, if you test with S8 or other new phone that may support 2Mbps you need to add this handler in on_ble_evt:

       case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
            {
                NRF_LOG_DEBUG("PHY update request.");
                ble_gap_phys_t const phys =
                {
                    .rx_phys = BLE_GAP_PHY_AUTO,
                    .tx_phys = BLE_GAP_PHY_AUTO,
                };
                err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
                APP_ERROR_CHECK(err_code);
            } break;
    
  • Hello Hung I have not tested it yet. The problem would be the 30 seconds just after the connection occurs. I need to show the 6 numbers of the PIN with led flashes, and that takes time. So I need to give the user enough time to take the PIN and after that make the connection to have all 30 seconds to ingress the PIN comfortably. The goal is basically to know the PIN before the connection is made. Possible? Thanks for your comments.

  • I afraid there is no way to generate the passkey before the pairing process starts. We have option to set static passkey but it's for the passkey for legacy pairing not LESC. Generating a static numeric number for LESC is not permitted by spec.

Related