BlueNRG-MS in central role can not get paired with another BlueNRG-MS in peripheral role
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 deviceI 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.