Skip to main content
Tino Beilken
Associate II
November 2, 2017
Question

BlueNRG-1 Automatic Connection after pairing

  • November 2, 2017
  • 7 replies
  • 1270 views
Posted on November 02, 2017 at 10:01

I have a little problem with BlueNRG-1 chip. I want that the first time I pair my phone with the BlueNRG-1 Testboard.

When I switch off bluetooth on my phone (iPhone) and the switch on, I want that my phone connects automatically to my BlueNRG-1 Testboard (like headphones).

But this doesn�t work.

The pairing process works well (first I get the event 'hci_le_connection_complete_event' and after the confirmation on my phone I get the event 'aci_gap_pairing_complete_event') but when I reconnect bluetooth the board goes always in the advertising mode and I don�t know why.

If the BlueNRG-1 needs to be configured or must the phone make sure that an automatic connection has been established?

#bluenrg-1-automatic-connection-after-pairing
    This topic has been closed for replies.

    7 replies

    Antonio Vilei
    ST Employee
    November 3, 2017
    Posted on November 03, 2017 at 15:26

    Dear Tino,

    please notice that the connection establishment procedure is always up to the Central device (the iPhone in your case) and not up to the Peripheral (BlueNRG-1 in your case).

    If BlueNRG-1 is advertising correctly, then your phone should be able to find it during scanning.

    If you want your iPhone to connect automatically to the BlueNRG-1, you should do it programmatically from iOS side.

    Best regards,

    Antonio

    Tino Beilken
    Associate II
    November 6, 2017
    Posted on November 06, 2017 at 07:58

    Hello Antonio,

    thank you for your answer. But I have one question: Do I need an own app to connect automatically?

    I think when the phone is paired with the BlueNRG-1, that the phone connects automatically to the board and I have nothing to do. Is it wrong ?

    Andrea Palmieri
    ST Employee
    November 6, 2017
    Posted on November 06, 2017 at 11:00

    Dear Tino,

    what is the program you are running on the BlueNRG-1 Peripheral?

    Kind regards

    Andrea

    Tino Beilken
    Associate II
    November 6, 2017
    Posted on November 06, 2017 at 11:18

    I write an own program on the BlueNRG-1 Peripheral.

    In the Init Function I send the following functions:

    ret = aci_gap_set_io_capability( IO_CAP_NO_INPUT_NO_OUTPUT );

    ret = aci_gap_set_authentication_requirement( BONDING, MITM_PROTECTION_NOT_REQUIRED, SC_IS_NOT_SUPPORTED, KEYPRESS_IS_NOT_SUPPORTED, 7, 16, DONOT_USE_FIXED_PIN_FOR_PAIRING, 123456, STATIC_RANDOM_ADDR );

    When I connect my phone with the BlueNRG-1 Board I get the follwing Event:

    hci_le_connection_complete_event.

    I send after 2s:

    ret = aci_gap_slave_security_req( connection_handle );

    Now I get the Event 'aci_gap_pairing_complete_event' but when I reconnect the BlueNRG-1 I get no automatically Connection to my board.

    Andrea Palmieri
    ST Employee
    November 6, 2017
    Posted on November 06, 2017 at 11:39

    One option to check the correctness of the security setting could be comparing your current configuration with the one implemented by the BLE_Security example included in the official

    http://www.st.com/content/st_com/en/products/embedded-software/evaluation-tool-software/stsw-bluenrg1-dk.html

     package.
    Tino Beilken
    Associate II
    November 8, 2017
    Posted on November 08, 2017 at 08:54

    Dear Andrea,

    I test the BLE_Security example for the STSW-BLUENRG-1-DK, but I have two problems:

    1. When I start the Pairing process everything works fine, but after 30s the Connection lost to the board. Why?

    2. I have the same Problem before. After a Pairing and a reset my board, the IPhone doesn´t connect to the board again

    Andrea Palmieri
    ST Employee
    November 8, 2017
    Posted on November 08, 2017 at 09:51

    Dear Tino,

    couldyou checkifsuch issue/behavioris also experienced with a mobile based on Android? For this use case, maybe

    Marchese.Graziella

    ‌ can provide further clarifications.