This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: Why LightBlue can not change the BLE device name after we update the software in cc2640r2f

Part Number: CC2640R2F
Other Parts Discussed in Thread: LAUNCHXL-CC2640R2

Hi team ,

  

       There is a issue from my ctm:After we reload the CC2640R2F with new ble device name in scanRsp package and let Iphone scan the BLE via lightblue app . It find that the ble device name is not changed. And the device name does not change yet after the lightblue connect the CC2640R2F firstly. It must disconnect firstly and scan once again then the device name will be updated. Can you help to solve the issue?

       Thank you !

  • You might need to clear the cache in your iPhone and restart BLE lightblue to see the change.

  • Hi Yikai,

     

          it's not changed after clearing the cache. The phenomenon will not happens when use other company cc2640r2f module even though the cache is not cleared. are there other reason causes the phenomenon? Thank you!

  • I do some test on simple_peripheral and find LightBlue uses attDeviceName so you have to change attDeviceName instead of scanRspData.

  • Hi Yikai,

     

            Sorry. The phenomenon is the same even though we attDeviceName in broadcast package

  • I try it and I can see it changes on my iPhone 7 plus.

  • Hi,

    Close LightBlue App, turn off Bluetooth, turn on Bluetooth, Open LightBlue App.

    -kel

  • Hi Markel,

     

           I have try by your method but the phenomenon is still the same . Thank you!

  • What smartphone do you test this?

  • Please note you must turn Bluetooth on/off via the Settings > Bluetooth menu since iOS will cache the name once it connects to the device.

    If this doesn't work, please post your code changes.

    Best wishes

  • Hi JXS,

          I had test the device with your guideline.But the phenomenon is the same. The test process is close Lightblue -> turn off ble via settings - Bluetooth ->reload device with new attDeviceName -> turn on ble via settings - Bluetooth -> open Lightblue and scan ble . I use the example -simple_peripheral which does not changed compare with V3_30 SDK. Thank you!

  • Hi Troyson,

    I am doing what you want to do using Simple Peripheral 3.30 I change the scanRspData[] to SimpleThermometer and attDeviceName to Simple Thermometer. I am using IOS LightBlue App at Iphone 4s works without problems. I just do what is recommended turn off on bluetooth. Same with IOS LightBlue App.

    -kel

  • Troyson Li said:

    Hi JXS,

          I had test the device with your guideline.But the phenomenon is the same. The test process is close Lightblue -> turn off ble via settings - Bluetooth ->reload device with new attDeviceName -> turn on ble via settings - Bluetooth -> open Lightblue and scan ble . I use the example -simple_peripheral which does not changed compare with V3_30 SDK. Thank you!

    Hi Troyson ,
    Can you paste/share you code modifications to simple BLE peripheral? That way we can run it on our side. I have seen in some cases where the name was malformed and iOS ignored the update and continued to use the cached version.
    Also, what is the iOS device & software version used.
    Thanks.
    Best wishes 
  • Hi JXS,

            Sorry for reply lingeringly. I have use different group(iPhone device + SDK version) to test but the phenomenon is always the same. I have also seen some similar case but it still not salved.

    Thank you for you continue to solve it !! 

            A.

            Device : iPhone 7 (Ios version 12.3.1)

            SDK version : 3.30/3.20

            LightBlue version:3.0.8

            Example: blestack\simple_peripheral

            Modify:just modify the attDeviceName (SimplePeripheral_taskFxn ->SimplePeripheral_init()->GGS_SetParameter->attDeviceName )

            B.   

            Device : iPhone 8 (Ios version 13.1.2)

            SDK version : 3.30/3.20

            LightBlue version:3.0.8

            Example: blestack\simple_peripheral

            Modify:just modify the attDeviceName (SimplePeripheral_taskFxn ->SimplePeripheral_init()->GGS_SetParameter->attDeviceName )

         

            C.

            Device : iPhone 6s (Ios version 12.0.1)

            SDK version : 3.30/3.20

            LightBlue version:3.0.8

            Example: blestack\simple_peripheral

            Modify:just modify the attDeviceName (SimplePeripheral_taskFxn ->SimplePeripheral_init()->GGS_SetParameter->attDeviceName )

     

  • Hi Troyson,

    I modified only the following line 270 in CC2640R2 SDK 3.30 blestack\simple_peripheral.c:

    // GAP GATT Attributes
    //static uint8_t attDeviceName[GAP_DEVICE_NAME_LEN] = "Simple Peripheral";
    static uint8_t attDeviceName[GAP_DEVICE_NAME_LEN] = "TI Peripheral 1234"; //max 21 chars

    Using iPhone 11 (iOS 13.3) + LightBlue

    Using IAR 8.32.2, built default simple_peripheral and programmed to LAUNCHXL-CC2640R2.

    Connect and confirm that name is default "Simple Peripheral"

    Modify line 270 (attDeviceName string) as noted above, rebuild and program LaunchPad

    In Light Blue, device was still listed as "Simple Peripheral" in the scan ("Peripherals Nearby"). This is expected.

    Connect, name is still displayed as "Simple Peripheral".

    Disconnect, then re-scan. Name is now "TI Peripheral 1234". Reconnect and name is still "TI Peripheral 1234".

    I did not need to disable Bluetooth on the iPhone.

    Can you start with a clean project, and make only the change as listed above to see if you get similar results?

    Best wishes 

  •   I think Troyson is asking why he need to connect BLE periphera and disconnect/rescan to see the update name? Why we cannot see the name update directly without connec/disconnect/rescan?

  • Hi Yikai ,

            Yes

  • Ah, thanks  I thought it was not updating but re-read the post.

    The behaviour that I listed (and what the OP is stating) is as expected for any iOS version I've used. Typically BLE device names don't change once they are programmed with their factory firmware, so it's probably not a use case they are optimizing their stack to account for the name changing frequently. It may also be more power efficient to cache the name as well. Just my guess though, you'd have to ask Apple since they don't release their Host stack source code. Note that Light Blue is an APP and thus only displays names for what the iOS stack provides to it.

     what is the use case that your customer is concerned about that results in the name changing after connection?

    Best wishes 

  • Hi Jxs,

          It‘s very strange that we can see new attDeviceName in other competitor cc2640r2f  module without process (connect->disconnect) . Do you know how the achieve it ? And  i will let my ctm reply you about the other question tomorrow. Thank you!

  • Hi Troyson,

    After looking further, there is a way to "trick" iOS to update the name without having to disconnect/re-connect after firmware update. That involves using a RPA (resolvable private address) vs. a public Bluetooth address (TI default for CC2640R2F / blestack is public address). Assuming you have not paired/bonded, the iOS device will see the module as a new device address each time it connects to the phone (after a power cycle or after 15 minutes if it has already scanned the module). This means it cannot cache the address as it does with public addresses. To configure to use an RPA, see this page:

    Note that you need to make the API addition directly to peripheral.c in gapRole_processGAPMsg after GAP_DEVICE_INIT_DONE_EVENT.

    Once you pair/bond, the iOS device will "know" your public address and be able to associate your RPA to your public address.

    Best wishes

  • Thanks for the solution. I test it and I can confirm it works. By the way, I see LightBlue use scanRspData instead of attDeviceName before connecting to show scan result after this modification. Once you use LightBlue to connect the device, it will use attDeviceName instead of scanRspData to show scan result.

  • Hi JXS ,

           Thank you ! I will let ctm test it. Why they concerned about that results in the name changing after connection is that they will choose some devices modifying their attname to test in many mass devices to do some tests. They need find the test device via attname quickly in lightblue.

  • Hi Troyson,

    Thanks for letting me know! If you don't mind and after the ctm confirms, can you please mark the thread as resolved / closed. 

    Just to summarize the behaviour of iOS, and by proxy Light Blue, as it relates to the display of the BLE device name

    When iOS has never connected to the device as identified by it's Bluetooth address (BDADDR): scan response name will be used in the scan results display list. Once iOS establishes a connection, the attDeviceName will be used for identifying the device, including all future scan results and connections. If the BLE device's BDADDR changes or the iOS performs a "Reset Network Settings" / factory reset, the scan response will be used. When just the attDeviceName has been updated (similar to your original question) after iOS has established a previous connection, you will have to disconnect and reconnect for the name to be reflected in Light Blue.

    Using an RPA on the BLE device (peripheral) will result in the above state machine reverting to iOS "thinking" that it has encountered a new device every time the RPA BDADDR changes. As stated previously, once your pair/bond, iOS will be able to uniquely identify the device by its RPA, thus it will use the attDeviceName in the scan result list.

    Best wishes