Where to call CyBle_GetDeviceAddress() function?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
PascalS
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hello,

I try to get a never changing and unique device identifier for the CYBLE-212006-01 BLE module  in PSoC Creator 4.2. I think, the silicon generated device address is the right property here.

2.PNG

So I need to get this device address in my program. Where should I call the function "CyBle_GetDeviceAddress()"? I tried it in main.c without any success, but in StackEventHandler() it works. Are there any pre conditions to call this function?

I tried it like this:

CYBLE_GAP_BD_ADDR_T test;

void StackEventHandler(uint32 eventCode, void *eventParam) {

...

test.type = 0;

CyBle_GetDeviceAddress(&test);

...

}

I set test.type to 0, to get the silicon generated device address. Is that right?

Thanks!

0 Likes
1 Solution
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

The address which we are configuring in the BLE component is Public device address only. This address is never changed and unique for each device. If we change the Bluetooth device address type to Random then only the address values are changed.

Please refer the section 7.2.1 Bluetooth Address Types for more information on different address types.

Thanks,

P Yugandhar.

View solution in original post

5 Replies
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

We have to call CyBle_GetDeviceAddress() API only after BLE stack is ON so we need to actually wait for the CYBLE_EVT_STACK_ON event and then use the GetDeviceAddress API.

Bluetooth address type(test.type) will give whether the address is Public device address or Random device address.

Thanks,

P Yugandhar.

0 Likes

Hello,

ok, but where is the difference between the "Public device address" and "Random device address"? It is not explained in the datasheet. And can I be sure, that this address is never changed and unique?

Thanks!

0 Likes

I found this article about Random and Public device addresses:

https://www.electronicdesign.com/communications/ble-v42-creating-faster-more-secure-power-efficient-...

Public Device Address: The Public Device Address is a combination of a company ID and a company-assigned ID per device following the IEEE 802-2001 standard. Company ID and company-assigned ID values are 24 bits each, constituting the total 48 bits of address as shown in Figure 1.

Random Device Address: As the name suggests, the Random Device Address is a randomly generated address. The Random Device Address is classified in two types, Static Random Address and Private Random Address.

The Static Random Address (Fig. 2) is either preprogrammed on a device before it’s shipped, or may change to a new value after each power cycle. However, a device isn’t supposed to change this address until the device goes through a power cycle. If this address is changed during runtime, the address stored in the peer device will not remain valid and the reconnection using the older address will fail.

So is the Random address programmed before shipped or may it chage?

Thanks!

0 Likes
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

The address which we are configuring in the BLE component is Public device address only. This address is never changed and unique for each device. If we change the Bluetooth device address type to Random then only the address values are changed.

Please refer the section 7.2.1 Bluetooth Address Types for more information on different address types.

Thanks,

P Yugandhar.

Perfect thanks!

0 Likes