cancel
Showing results for 
Search instead for 
Did you mean: 

BlueNRG-MS in central role can not get paired with another BlueNRG-MS in peripheral role

Cake Huang
Associate II
Posted on December 23, 2016 at 10:31

Can anyone provide sample project ofBlueNRG-MS in central role where security linking is required?

In sample project 'STM32CubeExpansion_BLE1_V2.7.0\Projects\Multi\Applications\SampleAppThT', it includes

central role but it does not require bonding/pairing.

I also checked 'OSXSmartConnPS\OSXSmartConnPS_V1.5.0\Projects\Multi\Applications\Profiles_Central\MDK-ARM\STM32L476RG-Nucleo',which does has central profile framework but no source code of this framework is provided.

I use

x-Nucleo-IDB05A1 kit to send pairing request toWesu kit.

x-Nucleo-IDB05A1 kit is set to central role whileWesu reference kit is coming with peripheral role naturally. Both sides are set to use fixed PIN code 1234

After connection is made,

x-Nucleo-IDB05A1 kit sends pairing request to

Wesu kit

by calling:

ret = aci_gap_send_pairing_request(connection_handle,0);

Immediately,

x-Nucleo-IDB05A1 gets an event of pairing completion with 0x02 which says pairing has just failed

0x02: Pairing failed

The pairing failed with the remote device

I tried using an android phone to pair with wesu kit and this was OK after I input 6 digit numbers of 123456 on my phone.

So something must be wrong with my

x-Nucleo-IDB05A1 central board but I could not figure it out.

I followed the documentDM00141271_ProgrammingManual.pdf to add pairing-related code on x-Nucleo-IDB05A1 kit.

Below are some parts of my code:

uint8_t DIV[2]={0x4A, 0x5D};

 

uint8_t ER[16]={0x4A, 0x5D, 0x9D, 0x5B, 0xA4, 0xCE, 0x2D, 0xE1, 0x72, 0x8E, 0x3B, 0xF4, 0x80, 0x35, 0x0F, 0x25};uint8_t IR[16]={0xE0, 0x7E, 0x21, 0xC9, 0x47, 0xD1, 0x9E, 0x33, 0x76, 0xF0, 0x9B, 0x3C, 0x1E, 0x16, 0x17, 0x42};

ret = aci_hal_write_config_data(CONFIG_DATA_PUBADDR_OFFSET,

CONFIG_DATA_PUBADDR_LEN,

bdaddr);

ret = aci_hal_write_config_data(CONFIG_DATA_DIV_OFFSET,

CONFIG_DATA_DIV_LEN,(uint8_t *) DIV);

ret = aci_hal_write_config_data(CONFIG_DATA_ER_OFFSET,

CONFIG_DATA_ER_LEN,(uint8_t *) ER);

/

ret = aci_hal_write_config_data(CONFIG_DATA_IR_OFFSET,

CONFIG_DATA_IR_LEN,(uint8_t *) IR);

ret = aci_gatt_init();

if(ret){

PRINTF('GATT_Init failed.\n');

}

if(BLE_Role == SERVER) {

if (bnrg_expansion_board == IDB05A1) {

ret = aci_gap_init_IDB05A1(GAP_PERIPHERAL_ROLE_IDB05A1, 0, 0x07, &service_handle, &dev_name_char_handle, &appearance_char_handle);

}

else {

ret = aci_gap_init_IDB04A1(GAP_PERIPHERAL_ROLE_IDB04A1, &service_handle, &dev_name_char_handle, &appearance_char_handle);

}

}

else {

if (bnrg_expansion_board == IDB05A1) {

ret = aci_gap_init_IDB05A1(GAP_CENTRAL_ROLE_IDB05A1, 0, 0x07, &service_handle, &dev_name_char_handle, &appearance_char_handle);

}

else {

ret = aci_gap_init_IDB04A1(GAP_CENTRAL_ROLE_IDB04A1, &service_handle, &dev_name_char_handle, &appearance_char_handle);

}

}

if(ret != BLE_STATUS_SUCCESS){

PRINTF('GAP_Init failed.\n');

}

//0x03: No Input, no output

ret = aci_gap_set_io_capability(IO_CAP_NO_INPUT_NO_OUTPUT);

if (ret != BLE_STATUS_SUCCESS) {

PRINTF('Failure.\n');

}

//aci_gap_clear_security_database();

ret = aci_gap_set_auth_requirement(MITM_PROTECTION_REQUIRED,

OOB_AUTH_DATA_ABSENT,

NULL,

7,

16,

USE_FIXED_PIN_FOR_PAIRING,

123456,

BONDING);

Note: this post was migrated and contained many threaded conversations, some content may be missing.
9 REPLIES 9
Andrea Palmieri
ST Employee
Posted on December 23, 2016 at 12:44

Hi Cake,

what is the FW version of the X-NUCLEO-IDB05A1 you are using? The document

DM00141271_ProgrammingManual.pdf  states that

Starting from BlueNRG-MS BLE FW stack 7.1b the IR and ER root keys are randomly

generated and permanently stored in internal BlueNRG-MS device Flash at the first

initialization of the device (ACI_GATT_INIT).

Kind regards,

Andrea

Posted on December 24, 2016 at 09:27

Hi Palmieri,

The FW version of the X-NUCLEO-IDB05A1 I am using is 0x0713. According to  DM00141271.pdf, my

X-NUCLEO-IDB05A1

 needs DIV/ER/IR configuration.

I also tried deleting below lines:

ret = aci_hal_write_config_data(CONFIG_DATA_DIV_OFFSET,

CONFIG_DATA_DIV_LEN,(uint8_t *) DIV);

ret = aci_hal_write_config_data(CONFIG_DATA_ER_OFFSET,

CONFIG_DATA_ER_LEN,(uint8_t *) ER);

/

ret = aci_hal_write_config_data(CONFIG_DATA_IR_OFFSET,

CONFIG_DATA_IR_LEN,(uint8_t *) IR);

But the pairing problem is still there.

Anyway,  Is there any reference projecct of central role which could demostrate successful pairing procedure between 2 BlueNRG/BlueNRG-MS? 

Thanks!

Posted on January 10, 2017 at 12:30

Did you consider the possibility to upgrade the FW to version 7.2c?

Posted on February 07, 2017 at 10:21

Hi 

Hi Palmieri,

I did not upgrade my 

X-NUCLEO-IDB05A1 board to version 7.2c. I did not know how to upgrade it.

Do I need some special tool? 

Posted on February 08, 2017 at 12:43

Hi,

you can use the flashUpdater java tool that can be found in

STM32CubeExpansion_BLE1_V2.8.0\Utilities\PC_Software\FlashUpdaterTool

Please, follow the steps described in the companion readme

Posted on February 09, 2017 at 10:07

First of all,thanks for your response.!

Unfortunately, my board got corrupted while upgrading with flashUpdater.jar. Now I could not recover it.

Everything was ok at the begining and upgrade  started to work untill

 flashUpdater.jar reported an usb communication error. And the progress bar  at the bottom of 

 

flashUpdater.jar indicated the upgrade did not achive 100%. Then by unplug and plug the usb cable, reopening the virtual com port,  flashUpdater.jar would always report it could not detect blueNRG-MS board.....

Can you please tell me how to recover from this situation?

I am using board as below:

NUCLEO_L476RG+X-NUCLEO-IDB05A1 

Posted on February 09, 2017 at 11:03

Dear Cake Huang,

no worries! After the failed upgrade, your chip is not responding properly but you can recover from this situation using this simple program:

https://developer.mbed.org/teams/ST/code/BlueNRG-MS-Stack-Updater/

Please notice that it is hosted on ARM mbed website. In order to generate the binary for your NUCLEO-L476RG, you need to register to the mbed website.

As an alternative, you could use the BlueNRG GUI. Anyway, I suggest the link above first because the procedure is simpler.

Kind regards.

Posted on February 10, 2017 at 10:18

Hi Vilei,

Yes, I have mbed account. And I have successfully imported this updator project onto my workspace and compiled it,downloaded onto my

NUCLEO-L476RG

board.

But it seems my board could not work. I got message printed out from standard uart port'ERROR: Unable to get HW version

'. This should come from below lines:

bleDevice = (BlueNRGDevice*) createBLEInstance();

get_hw_version_status = bleDevice->getUpdaterHardwareVersion(&hw_version);

if (get_hw_version_status != BLE_STATUS_SUCCESS) {

printf('ERROR: Unable to get HW version\n\r');

error_loop();

}

It seems my board does not respond to HCI command of reading local HW&SW information.And this seems reasonable since the image inside the blueNRG MS chip has gone.

Again, I replace

X-NUCLEO-IDB05A1 with my anotherX-NUCLEO-IDB04A1

exapsion board. I got messages'Sorry, you're HW version is not supported'.

This indicats that my

NUCLEO-L476RG andX-NUCLEO-IDB04A1 are OK.ButX-NUCLEO-IDB05A1 exapasion board is not working.(It's not likely it is damaged.)

So the question is:

Can this mbed updater cope with the board that there is no image at all inside the

blueNRG MS

?

Cake Huang
Associate II
Posted on February 21, 2017 at 09:32

Thank palmieri&vilei,

After spending some efforts I have recovered my 

X-NUCLEO-IDB05A1 and its firmware is now updated to 7.2c

Both STSW-BNRGUI and mbed's BlueNRG-MS-Stack-Updater can be used to update  

X-NUCLEO-IDB05A1.

And 7.2c setted to central role can successfully get paired with another ble peripheral role,here in my case the peripheral is a standard BLE mouse.

Thank you again!