2024-07-15 11:12 PM - edited 2024-07-16 04:52 PM
Hi, I have a question.
I am developing a BLE HIID device using the STM32WB55 evaluation board.
I am not sure how to identify multiple devices with the same firmware loaded.
The problem I am currently encountering is as follows ↓↓↓.
I would appreciate it if you could tell me the cause of this phenomenon described above!
Thank you in advance.
Solved! Go to Solution.
2024-07-23 08:34 AM
Hello @ELEHM
I think this should be due to the fact that Win10 doesn't accept different devices pair with the same IRK (Identity Root Key). So, I suggest you update the #define CFG_BLE_IRK on the app_conf.h file of your project and give a new value for each node.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-07-15 11:17 PM - edited 2024-07-15 11:18 PM
The sample I am using is BLE_HID from STM32CubeWB.
/***
* Static random address
* The two upper bits shall be set to 1
* The lowest 32bits is read from the UDN to differentiate between devices
* The RNG may be used to provide a random number on each power on
*/
#if (CFG_IDENTITY_ADDRESS == GAP_STATIC_RANDOM_ADDR)
#if (CFG_STATIC_RANDOM_ADDRESS)
a_srd_bd_addr[0] = CFG_STATIC_RANDOM_ADDRESS & 0xFFFFFFFFFF;
a_srd_bd_addr[1] = (uint32_t)((uint64_t)CFG_STATIC_RANDOM_ADDRESS >> 32);
a_srd_bd_addr[1] |= 0xC000; /* The two upper bits shall be set to 1 */
The CFG_STATIC_RANDOM_ADDRESS here is changed for each evaluation board.
ret = aci_hal_write_config_data(CONFIG_DATA_RANDOM_ADDRESS_OFFSET, CONFIG_DATA_RANDOM_ADDRESS_LEN, (uint8_t*)a_srd_bd_addr);
if (ret ! = BLE_STATUS_SUCCESS)
{
APP_DBG_MSG(" Fail : aci_hal_write_config_data command - CONFIG_DATA_RANDOM_ADDRESS_OFFSET, result: 0x%x \n", ret); }
}
}
{
APP_DBG_MSG(" Success: aci_hal_write_config_data command - CONFIG_DATA_RANDOM_ADDRESS_OFFSET\n"); }
APP_DBG_MSG(" Random Bluetooth Address: %02x:%02x:%02x:%02x:%02x:%02x:%02x\n", (uint8_t)(a_srd_bd_addr[1] >> 8),
(uint8_t)(a_srd_bd_addr[1]),.
(uint8_t)(a_srd_bd_addr[0] >> 24),(uint8_t)(a_srd_bd_addr[0] >> 24),(uint8_t)(a_srd_bd_addr[1] >>
(uint8_t)(a_srd_bd_addr[0] >> 16),(uint8_t)(a_srd_bd_addr[1])
(uint8_t)(a_srd_bd_addr[0])));
}
The write method probably hasn't been modified in any way
2024-07-23 08:34 AM
Hello @ELEHM
I think this should be due to the fact that Win10 doesn't accept different devices pair with the same IRK (Identity Root Key). So, I suggest you update the #define CFG_BLE_IRK on the app_conf.h file of your project and give a new value for each node.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-07-23 07:29 PM - edited 2024-07-23 07:31 PM
Hello. @STTwo-32
Thanks for the reply. I understand now.
Is there a problem with generating a 16 byte array for IRK when powering up in RNG, etc.? (Would the same process be required for LTKs?)
For example, as shown below↓↓
CreateRandomNumbers(a_BLE_CfgIrValue, sizeof(a_BLE_CfgIrValue));
ret = aci_hal_write_config_data(CONFIG_DATA_IR_OFFSET, CONFIG_DATA_IR_LEN, (uint8_t*)a_BLE_CfgIrValue);
static void CreateRandomNumbers(uint8_t *buffer,size_t length)
{
uint32_t random32;
/* Get RNG semaphore */
while(LL_HSEM_1StepLock(HSEM, CFG_HW_RNG_SEMID));
/* Enable RNG */
__HAL_RNG_ENABLE(&hrng);
/* Enable HSI48 oscillator */
LL_RCC_HSI48_Enable();
/* Wait until HSI48 is ready */
while(! LL_RCC_HSI48_IsReady());
for (size_t i = 0; i < length; i += 4)
{
if (HAL_RNG_GenerateRandomNumber(&hrng, &random32) != HAL_OK)
{
/* Random number generation error */
Error_Handler();
}
buffer[i] = (random32 >> 24) & 0xFF;
buffer[i + 1] = (random32 >> 16) & 0xFF;
buffer[i + 2] = (random32 >> & 0xFF;
buffer[i + 3] = random32 & 0xFF;
}
/* Disable HSI48 oscillator */
LL_RCC_HSI48_Disable();
/* Disable RNG */
__HAL_RNG_DISABLE(&hrng);
/* Release RNG semaphore */
LL_HSEM_ReleaseLock(HSEM, CFG_HW_RNG_SEMID, 0);
}