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

PIn Pairing

Hi Nordic guys,

I'm trying to create a pin pairing between an NRF52 DK and iPhone.

I've created this function to do that:

void generate_key(void){
  
  ret_code_t err_code;
  ble_opt_t passkey;

  uint8_t new_passkey[] = "123456";


  NRF_LOG_INFO("Setting new passkey: %s", nrf_log_push(new_passkey));

  passkey.gap_opt.passkey.p_passkey = new_passkey;

  err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &passkey);
  APP_ERROR_CHECK(err_code);

}

I've added that function in the ble_peripherical template code, in the void gap_params_init(void) function.

Any idea why the NRF doesn't ask me about the pairing key?

Best regards,

Jorge.

Parents
  • Hi Jorge, 

    I have tested your code, and it can work. Did you bond with the device in the nRF Connect?

    -Amanda H.

  • Hi Amanda,

    Many thanks for your quick reply!

    I was checking for that option in the iPhone nRF Connect App, but I didn't find it. Are you sure that the code works? The device connected to the phone and I can see the service and characteristics but it didn't ask me about the pin pairing.

    Could you try the code in the same conditions??

    Best regards,

    Jorge.

  • Hi Jorge, 

    Sorry for the mistake. I thought it was the same as the Android app. I am wrong. 

    There's a bug in the nRF connect app on iOS that will cause it to disconnect after pairing/bonding, which I have reported internally. You may try a third-party app such as Lighblue and see if you get the same result. See this post. If that still cannot help you, please create a new support case. I will start the vacation next week. 

    The support staff is reduced during the summer holidays, and you may experience delayed answers.

    -Amanda H.

  • Hi Amanda,

    I hope that your summer holydays have been enjoyed. I'm back again too. I was taking a look to the post, but I didn't be able to solve the problem.

    Could you send me a tested code to get that the nRF ask me about a pin??

    Also, I'm working in a custom PCB, and I'll like to use the nRF9160 for NB-IoT and LTE-M communications, do you know if it comes with the AT commands firmware from factory, or I've to upload it by the SWD pins?

    Best regards,

    Jorge,

  • Hi Jorge, 

    I have added your code into SDK 17 ble_app_template as ble_app_template_253154.zip. When you bond with the device from nRF Connect, the device will ask to give pin code as "123456". As I mentioned in the previous reply, I only test on the Android phone because I don't have an iOS phone. 

     

    decastro_25 said:
    Also, I'm working in a custom PCB, and I'll like to use the nRF9160 for NB-IoT and LTE-M communications, do you know if it comes with the AT commands firmware from factory, or I've to upload it by the SWD pins?

    You have to upload it by the SWD pin. Please see nRF9160 DK Getting Started. If you have further questions regarding nRF9160, please create a new support case. It will be easy for you and us to manage the issue. It will also benefit other users to search for solutions. This is far away from the original post. 

    -Amanda H.

Reply
  • Hi Jorge, 

    I have added your code into SDK 17 ble_app_template as ble_app_template_253154.zip. When you bond with the device from nRF Connect, the device will ask to give pin code as "123456". As I mentioned in the previous reply, I only test on the Android phone because I don't have an iOS phone. 

     

    decastro_25 said:
    Also, I'm working in a custom PCB, and I'll like to use the nRF9160 for NB-IoT and LTE-M communications, do you know if it comes with the AT commands firmware from factory, or I've to upload it by the SWD pins?

    You have to upload it by the SWD pin. Please see nRF9160 DK Getting Started. If you have further questions regarding nRF9160, please create a new support case. It will be easy for you and us to manage the issue. It will also benefit other users to search for solutions. This is far away from the original post. 

    -Amanda H.

Children
No Data
Related