Reply
Highlighted
Posts: 7
Registered: ‎09-21-2017

How to change the UUID and minor number

Hi,

 

I am new bee to the BLE world. I got EFR32MG based SLWSTK and exploring how does it works...

 

In Simplicity IDE I had created a project using Bleutooth SDK2.4.2.0, SOC -iBeacon and flashed two of the Mighty Gecko boards. Using "locate" iphone application I am seeing both the devices are showing same UUID, Major number and Minor number. 

 

Below are my questions:

1. How to change the UUID of the BLE device? 

2. How to change the minor number?

 

What I am trying to achieve as a first step:  

Want to see the two nodes in the "locate" iphone application with different UUID and minor numbers.

 

Thanks in advance.

 

Regards,

Ajay.

Posts: 2,732
Registered: ‎09-01-2015

Re: How to change the UUID and minor number

Did you check through the source code? See function bcnSetupAdvBeaconing() in file main.c.

 

These are the lines that initialize beacon major/minor numbers

    /* Beacon major number */
    /* Set to 34987 and converted to correct format */
    { UINT16_TO_BYTE1(34987), UINT16_TO_BYTE0(34987) },

    /* Beacon minor number */
    /* Set as 1025 and converted to correct format */
    { UINT16_TO_BYTE1(1025), UINT16_TO_BYTE0(1025) },
Posts: 7
Registered: ‎09-21-2017

Re: How to change the UUID and minor number

Hi KaakkoV

 

Thank you for your response.

 

Yes, I checked in the code and I was able to change using the code. Considering this, If have 1000 beacons do we need to have 1000 binary or hex files?

 

What I am trying to do here is, I want to flash the single binary in all the beacon devices and change the UUID, major number and minor number as per the needs.

 

Regards,

Ajay.

 

 

Posts: 2,732
Registered: ‎09-01-2015

Re: How to change the UUID and minor number


Ajay2017 wrote:

Hi KaakkoV

Considering this, If have 1000 beacons do we need to have 1000 binary or hex files?

 

 

 


No, you don't need to use hard-coded major/minor values in the source code. There are several possible options to generate the major/minor numbers programmatically at runtime.

 

For example, you can derive the major/minor numbers from the Bluetooth address of the device. Bluetooth address can be checked at runtime using command cmd_system_get_bt_address.

 

Another possibility would be to store the major and minor numbers in Persistent Storage. See commands cmd_flash_ps_save and cmd_flash_ps_load in the API reference manual.

 

Yet another possibility is to write the major/minor numbers in the flash memory directly, for example using the User Data page that is located at offset 0x0FE00000. Your application can read the values from flash at startup and then set up the beacon payload accordingly.

 

 

 

Posts: 7
Registered: ‎09-21-2017

Re: How to change the UUID and minor number

Super, thank you very much.

 

Can you also please suggest me how to change the UUID at run time? This is because, when I program two of my mighty geckos with same binary they are showing same UUID ( I am using "locate" iphone application).

 

Regards,

Ajay.

Posts: 2,732
Registered: ‎09-01-2015

Re: How to change the UUID and minor number

The UUID is set in the same function that I pointed above. But I don't see why you need to change the UUID for each beacon? 

 

In my understanding, the UUID is assumed to be same for all of beacons that belong to same group and then individual beacons are distinguished by the major / minor numbers. For example, see this link:

https://kontakt.io/blog/beacon-id-strategy-guide-quick-deployment/

 

The major and minor numbers are 16-bit, meaning you can have 2^32 individual major-minor combinations.

 

Posts: 7
Registered: ‎09-21-2017

Re: How to change the UUID and minor number

Hi, 

I am trying to read the bluetooth public address using the below line of code and observed that the addr array is being updated. 

 

gecko_msg_system_get_bt_address_rsp = *gecko_cmd_system_get_bt_address();

 

I added "gecko_msg_system_get_bt_address_rsp " to the watch window and observing the addr array during debug and don't see the array being updated. Is there anything that I am missing here?

 

Regards,

Ajay.

 

 

Posts: 7
Registered: ‎09-21-2017

Re: How to change the UUID and minor number

Hi,

Is there any way to change the major and minor number over the air? If yes can you please give me implementation details.

 

Regards,

Ajay.

Posts: 2,732
Registered: ‎09-01-2015

Re: How to change the UUID and minor number


Ajay2017 wrote:

 

 

I added "gecko_msg_system_get_bt_address_rsp " to the watch window and observing the addr array during debug and don't see the array being updated. Is there anything that I am missing here?

 

 

 


gecko_msg_system_get_bt_address_rsp is a pointer to a struct that is statically allocated. Are you sure you are not just watching the value of the pointer that is not changing (as expected) ?

 

Posts: 2,732
Registered: ‎09-01-2015

Re: How to change the UUID and minor number


Ajay2017 wrote:

Hi,

Is there any way to change the major and minor number over the air? If yes can you please give me implementation details.

 

 


Yes, this is possible. One possible implementation:

 

you save the value of major / minor numbers in a PS key. See commands cmd_flash_ps_load / cmd_flash_ps_save in the API reference manual.

 

To support changing these values over the air, you need to make the device advertise as connectable (iBeacon example is non-connectable by default). If you add two new characteristics in the GATT database and make the writable, then the client that connects to the device can use these characteristics to update the major/minor values.

 

When a characteristic is written you will receive event evt_gatt_server_attribute_value from the stack. Your application can then take the value that was written and store it permanently by calling  cmd_flash_ps_save. You then re-initialize the advertising using the new data.

 

Data stored in PS keys is preserved over reboots and power cycles. At each power-up, you need to load the latest values from PS and initilize the advertising data based on those values.

Posts: 7
Registered: ‎09-21-2017

Re: How to change the UUID and minor number

Thank you.

 

I added to two characteristic (sensor location and user Index) and updated the code to change the major/minor numbers when sensor location and user Index data is received.

 

Could you please let me know how can I change these characteristic values externally? I am trying with Blue Gecko iphone application and I don't see any opting to change the characteristic values.

 

Regards,

Ajay.

Posts: 2,732
Registered: ‎09-01-2015

Re: How to change the UUID and minor number

See the screenshots in this KB article:

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/Uploading-images-to-slots-using-OTA-DF...

 

You open Bluetooth Browser in Blue Gecko app, connect to your device. Then locate the characteristic in the GATT database. Press the pen icon to edit value of characteristic. 

 

Did you remember to enable write property for the characteristics that you added?

Posts: 7
Registered: ‎09-21-2017

Re: How to change the UUID and minor number

Yes, I enabled write properties for both sensor location and user Index.

 

I am unable to see my iBeacon BLE device in Bluetooth Browser but I am able to see in the Bleutooth Beaconing (showing the minor number).

 

I made sure that location services is ON. Is there anything that I need to do to see the BLE device in Bluetooth Browser?

 

Regards,

Ajay.