11 Replies Latest reply on Aug 26, 2019 1:32 AM by KeSo_2153826

    Changing BD_ADDR from the application

    user_2112781

      Hello,

       

      I would like to change the BLE address  of the device but directly from the device running itself.

       

      I know that the address is stored in the EEPROM in the DS1 at offset 0xFF000015 to 0xFF00001b and I can change it directly via bleappfwu_writeMem and when I reboot I indeed get the desired address.

       

      But is there a better way to change the value of the BLE address stored in the EEPROM ? I found blecm_set_static_random_bd_addr but once again, the address must be set to 0xffffffffffff in the EEPROM before calling it.

        • 1. Re: Changing BD_ADDR from the application
          MichaelF_56

          I have asked the developers if they could respond and verify this functionality is supported within the SDK.

          • 2. Re: Changing BD_ADDR from the application
            MichaelF_56

            I think what you are referring to is called a resolvable private address (RPA) and it is currently unsupported.


            RPA is a feature that allows your device to change it's BD_ADDR such that a paired device can still understand it's the same device.  I believe that an iOS device supports RPA and changes the BD_ADDR every 15 minutes.  It can do this because during the pairing process a special key is distributed to the peer.  Therefore, when a peer sees the advertisement from the iPhone, it can decode the BD_ADDR and understand that it is the same device that it was paired with initially.

             

            The BCM20736/7 supports connections from devices that change BD_ADDRs in this manner, however, these devices do not have logic built in to change their own BD_ADDR.

             

            VictorZ_46

            • 3. Re: Changing BD_ADDR from the application
              MichaelF_56

              Note that I confirmed with the developers that what you are trying to accomplish through the API changing the BD_ADDR is unsupported.

              • 4. Re: Changing BD_ADDR from the application
                user_2112781

                Thank you for your answer.

                Just to be clear,  I don't want to change it dynamically and keep the device running with the new address.  I would just like to be able to change it and have it up and and running after reboot. This works when I first set the address to FFFFFFFFFFFF then upload the firmware to the board and call blecm_set_static_random_bd_addr,  I get a new random address but I can't call this a second time as I would need to set the address again to FFFFFFFFFFFF.

                • 5. Re: Changing BD_ADDR from the application
                  VictorZ_46

                  You shall not change device bdaddr on every reboot.  And you should not change address by writing into a hardcoded memory address.  You can use blecm_set_static_random_bd_addr function.  As you correctly noticed this generates a random address and saves it in the NVRAM.  But in addition to that, device type is changed from public to private.  The address should not be changed for the lifetime of the device.  Otherwise you will be violating Bluetooth SIG policy.

                  • 6. Re: Changing BD_ADDR from the application
                    user_2112781

                    VictorZ_46, the address type does not seem to be changed, I always see it as public (0x0).

                    Can we change the address type advertised ?

                    • 7. Re: Changing BD_ADDR from the application
                      StBa_721356

                      I guess one can use blecm_startAdv() to specify if the own address is random by setting the advAdrType parameter to 1.

                      See the documentation of blecm_startAdv() in Connectable vs. nonconnectable Advertisements.

                      1 of 1 people found this helpful
                      • 8. Re: Changing BD_ADDR from the application
                        hachc_2137126

                        Hi VictorZ_46,

                         

                          Regarding to your description here

                        You shall not change device bdaddr on every reboot.

                         

                          I don't see the same expression from the BT spec as below, which is cited from section 10.8.1 of Part C. of Volume 3.

                        A device may choose to initialize its static address to a new value after each

                        power cycle. A device shall not change its static address value once initialized

                        until the device is power cycled.

                        Note: If the static address of a device is changed then the address stored in

                        peer devices will not be valid and the ability to reconnect using the old address

                        will be lost.

                         

                          So, if we need to change the BD address in every reboot, then what would be the limit of write cycle to EEPROM that storing the BD_ADDRESS, in case that we need to write it to '0xFFFFFFFFFFFF' before calling 'blecm_set_static_random_bd_addr'?

                        • 9. Re: Changing BD_ADDR from the application
                          JensonY_96

                          The API: blecm_set_static_random_bd_addr() is undefined with SDK: WICED-Smart-SDK 2.2.3.

                          Which version of SDK contain this API? Could you please share a demo code if convenient?

                          • 10. Re: Changing BD_ADDR from the application
                            mima_1250261

                            Hello all,

                             

                            I am using the EEPROM with normal OTA settings as recommended (SS1,SS2,DS1,DS2).

                             

                            I know that the BLE address is stored in the EEPROM in the DS1 at offset 0xFF000015 to 0xFF00001b and I can change it directly via bleappfwu_writeMem and when I reboot I indeed get the desired address.

                             

                            HOWEVER if we are running in DS2 what address is the BLE address retrieved from? 0xFF000015 appears to be in SS1, is this correct? I attempted to use 0xFF000115 without success (SS2 offset applied).

                             

                            I am not able to set a new BLE address when the device is running in DS2. I get a previously set address. Here is the code that writes the address

                             

                               ble_trace1("EEPROM: %d",NV_IS_EEPROM());

                               if (!NV_IS_EEPROM())

                               {

                                  // Erase sector if SF before writing.

                                  temp = bleappfwu_eraseMem(BD_ADDR_MEM_START, BD_ADDR_LEN);

                               }

                             

                               // Write this to the active SS.

                               temp = bleappfwu_writeMem(p_bd_addr, BD_ADDR_MEM_START, BD_ADDR_LEN);

                             

                               ble_trace1("Write Status: %d",temp);

                            • 11. Re: Changing BD_ADDR from the application
                              KeSo_2153826

                              Hello mima_1250261,

                              I'm seeing the same problem.

                              Did you find a way to change Bluetooth address after performing OTA firmware update (SS2 is activated)?