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.

CC1352R: LightBlue App scan BLE address based on simple peripheral application

Part Number: CC1352R
Other Parts Discussed in Thread: SYSCONFIG,

SDK: simplelink_cc13x2_26x2_sdk_4_20_00_35

CCS: Code Composer Studio 10.0.0

Note: I just use only the legacy advertisement.

I want to ask something about the names display in LightBlue when I use LightBlue scan CC1352 device. In the original simple peripheral example, the name "Simple Peripheral" will display in LightBlue when I scan CC1352 device using LightBlue App. I refer to TI office documentation. There are three places related to the names in simple_peripheral.syscfg. In .syscfg, I see the following configurations

  1. General Configuration->Device Name(Simple Peripheral)
  2. Broadcaster Configuration->Advertisement Data1->Shortened Local Name(SP). Not using Complete Local Name.
  3. Broadcaster Configuration->Scan Response Data 1->Complete Local Name(Simple Peripheral). Not using Shortened Local Name.

First, I want to know :

  1. Which configuration is it related to the display name in LightBlue when I use LightBlue App scan the CC1352 device? It confused me because I almost always see "Simple Peripheral" on LightBlue but occasionally can also see "SP" on LightBlue.
  2. Why can we use shortened local name in advertisement data 1 and complete local name in scan response data 1?
  3. I want to add BLE address to the names display in LightBlue like "Simple_xxxxxxxxxxxx" when I use LightBlue scan the CC1352 device. What things can I do to achieve this function? Any good suggestions?

I have tried to manually modify the advData1 and scanResData1 array to add BLE address for name because I want to add the device identity address to the name. But it seems nothing works and I can still scan the "Simple Peripheral" on LightBlue App and nothing changes. Thanks.

BRs.

  • Hi,

    Thanks for your inquiry. I notified a team member and she will provide additional insights as soon as possible.

    In the meantime, can you check the SimpleLink Academy "Scanning and Advertising" module to get additional details about how to change the advertising parameters?

    https://dev.ti.com/tirex/explore/node?node=AAqqwhkEV.0hRKMj.vsvTA__pTTHBmu__LATEST

    Regards,

    Rafael

  • Hi,

    I have refered to the SimpleLink Academy "Scanning and Advertising" and my above modifications are based on SimpleLink Academy "Scanning and Advertising". In addition, although SimpleLink Academy "Scanning and Advertising" about how to change the advertising parameters is there, it doesn't satisfy my custom requirements that I have posted above. Thanks.

    BRs.

  • Hello,

    1. The Complete Local Name field within SysConfig BLE is what's associated with the name you are seeing on the LightBlue list.

    2. The Bluetooth Core Specification specifies the use of a local name and a shortened local name. The shortened local name should only contain contiguous characters from the beginning of the full name hence SP for Simple Peripheral. Please refer to the Bluetooth Core Specification Supplement document for more information on this.

    In regards to you occasionally seeing SP instead of Simple Peripheral can you describe specific steps you take to view this behavior?

    3. In regards to adding the BLE address to the display name there are 3 places you have to modify to have "Simple_<address>" displayed. I have verified these steps on an OOB simple_peripheral project from simplelink_cc13x2_26x2_sdk_4_20_00_35 and confirmed that the new name appears on LightBlue (running on an Android device):

    - Modify General Configuration -> Device Name

    - Modify Broadcaster Configuration -> Scan Response Data 1 -> Complete Local Name

    - Modify Broadcaster Configuration -> Scan Response Data 2 -> Complete Local Name

    After making the following modifications, you should see your desired name appear on the LightBlue list.

    Please let me know if this helps to resolve your issue or if more clarification is needed!

    Best Regards,

    Jenny

  • Hi, Jenny:

    For your question, In regards to you occasionally seeing SP instead of Simple Peripheral can you describe specific steps you take to view this behavior?

    Actually, I always use CCS IDE for flashing and debug the simple peripheral application. That is to say, I just try flash and debug the application to the CC1352R then run the application through CCS. After that I can scan the device "Simple Peripheral" through LightBlue App. I always repeat these procedures during my development. Just as I said, I occasionally(rarely) see "SP" on the LightBlue App and the iPhone still can connect the CC1352R device through "SP".

    For your modification, I see you're right when make the above modifications. But this is not my custom requirement. For example, If I have some CC1352R chips, I just want to recognize them through "Simple_<address>" when I scan them using LightBlueApp. I think every CC1352R device has its own device identity address(BLE address) and I can get the Identity in my source code. But I don't know where to set the identity address in order to be scanned by LightBlue App.

    If I make modifications according to your suggestions, it seems just the modification can't meet my requirement. Your suggested modifcations just works for one CC1352R chip. Is it my understanding right? Any good suggestions to meet my requirements?

    Thank you very much. Jenny.

    BRs.

  • Hello,

    I apologize for not understanding your question clearly, thank you for the clarification!

    You can get your BLE MAC address by utilizing this line of code:

    #include <inc/hw_fcfg1.h>
    uint64_t bleAddress = *((uint64_t *)(FCFG1_BASE + FCFG1_O_MAC_BLE_0)) & 0xFFFFFFFFFFFF;

    In addition, navigate to the function SimplePeripheral_processGapMessage within simple_peripheral.c. Within this function, locate this piece of code:

            // Load scan response data for set #1 that is statically allocated by the app
            status = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_SCAN_RSP,
                                         sizeof(scanResData1), scanResData1);

    The buffer scanResData1 contains the complete name that is being generated by SysConfig. What I did was create another buffer within simple_peripheral.c for example:

    // Scan Response Data
    uint8_t scanResDataExample[] =
    {
      0x12,
      GAP_ADTYPE_LOCAL_NAME_COMPLETE,
      'S',
      'i',
      'm',
      'p',
      'l',
      'e',
      ' ',
      'T',
      'e',
      's',
      't',
    
      0x02,
      GAP_ADTYPE_POWER_LEVEL,
      0,
    
      0x05,
      GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE,
      LO_UINT16(80),
      HI_UINT16(80),
      LO_UINT16(104),
      HI_UINT16(104),
    
    };

    And replaced scanResData1 with scanResDataExample. I verified that this name change was present within LightBlue. In your case of wanting the unique address to appear, instead of the 'T', 'E', 'S', 'T' portion, you would have to modify this array that you create within simple_peripheral.c to include the unique BLE address of this device.

    Best Regards,

    Jenny

  • Hi,Jenny:

    Thank you very much for such detailed response. I have done your above modifications several days ago but I didn't get the expect result. Today I receive your confirmation about this method. I do it again according your above steps. Finally maybe I find the failure cause. Previously, I define the Scan Response Data in function SimplePeripheral_processGapMessage like the following code:

    // Scan Response Data
    uint8_t scanResDataExample[] =
    {
      0x12,
      GAP_ADTYPE_LOCAL_NAME_COMPLETE,
      'S',
      'i',
      'm',
      'p',
      'l',
      'e',
      ' ',
      'T',
      'e',
      's',
      't',
    
      0x02,
      GAP_ADTYPE_POWER_LEVEL,
      0,
    
      0x05,
      GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE,
      LO_UINT16(80),
      HI_UINT16(80),
      LO_UINT16(104),
      HI_UINT16(104),
    
    };
    // Load scan response data for set #1 that is statically allocated by the app
    status = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_SCAN_RSP,
                                 sizeof(scanResDataExample), scanResDataExample);

    It doesn't work as I expect. Today, after your confirmation. I try to define the Scan Response Data array as a global variable not in the function SimplePeripheral_processGapMessage. It works as what you show. Now I can see the "Simple_<address>" in LightBlue App. Just change the place to define Scan Response Data array and it works. Is this the root cause? It confuses me so much. Can you explain this to me?

    Although I can see the "Simple_<address>" in LightBlue. But when I connect the CC1352R through LightBlue, then disconnect it. Again, when I scan the device through LightBlue, the name displayed in LightBlue is changed to the original name ""Simple Peripheral". Why does this happen? It also confuses me a lot. Can you give me some suggestions about this?

    Thany you for your patience again.

    BRs.

  • Hello,

    I was able to reproduce the same behavior where the name wasn't appearing when the scanResDataExample array was defined locally. At this moment I'm not sure of why defining it globally or locally should affect the name appearing, but I will try to look into it some more and give you an answer on what is causing this.

    I wasn't able to see this behavior of the name reverting back to "Simple Peripheral" after I defined it as "Simple Test". I have two questions in regards to this:

    1. Are there any additional steps taken such as reading or writing a characteristic? I connected to "Simple Test", disconnected, reconnected to "Simple Test" and repeated these steps a few times. The name didn't revert back to "Simple Peripheral" on LightBlue for me.

    2. Can you provide the exact code snippet you are using to set the name to be "Simple_<address>"? I can attempt to recreate this based on the code you are using.

    The phone could be somehow caching "Simple Peripheral" and reverting back to the older name.

    Best Regards,

    Jenny

  • Hi, Jenny:

    Thank you for doing verification. For your questions:

    1. Are there any additional steps taken such as reading or writing a characteristic?

    No. I didn't add any additional steps to read or write characteristic. But according to your reminder, I have checked the source code in simple peripheral application, I notice the following code related to writing characteristic.

     // Set the Device Name characteristic in the GAP GATT Service
      // For more information, see the section in the User's Guide:
      // software-dl.ti.com/.../
      GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDeviceName);
    
    uint8_t attDeviceName[GAP_DEVICE_NAME_LEN]= "Simple Peripheral";

    Because the above code is original code in simple peripheral application and I don't modify them. Today, I try to comment out above function GGS_SetParameter. Everything is OK. I can connect and disconnect with same name "Simple_<address>" through BlueLight. Although I can do scan the same name through LightBlue, I need to comment out the orginal source code function GGS_SetParameter otherwise I will still scan the name "Simple Peripheral". I don't know why you can it successfully.

    2. Can you provide the exact code snippet you are using to set the name to be "Simple_<address>"? 

    Actually, first I use your above example code "Simple Test" to test this function. If I don't comment out the function GGS_SetParameter, the result will be the previous problem. If I comment out GGS_SetParameter call in function SimplePeripheral_init, everything is ok(Always scan "Simple Test") and the result will be what you have done.

    I want to know if I comment out the function GGS_SetParameter, is there any other side effect? or Do I need to modify attDeviceName to the same name as Scan Response Data(including BLE address), then call function GGS_SetParameter as the original source code?

    Thanks, Jenny.

    BRs.

  • Hello,

    Thank you for your thorough response!

    1. That is interesting that while I have it untouched, I somehow still see my modified name. But that's also good to hear that once commenting out this array, you were able to successfully scan the name "Simple_<address>" without any issues of the name reverting back to "Simple Peripheral".

    2. Yes I would modify or create your ATT device name to be the same name as the one you are using for your Scan Response Data and then call the function GGS_SetParameter as you detailed in your code snippet in your previous response and in the "Using the GGS" section of the User's Guide (

    http://software-dl.ti.com/simplelink/esd/simplelink_cc13x2_26x2_sdk/3.40.00.02/exports/docs/ble5stack/ble_user_guide/html/ble-stack-5.x/gatt.html#using-the-ggs

    )

    I went ahead and created a new attDeviceName array and passed this array into the GGS_SetParameter and verified that there wasn't an adverse effect. The modified name showed up on LightBlue for me.

    Please let me know this works for you!

    Best Regards,

    Jenny

  • Hi, Jenny:

    Today, I try to do modifications as follows:

    uint8_t attDevName[GAP_DEVICE_NAME_LEN]= "Type-2BE VSN";
      uint8_t addrStr[3 * B_ADDR_LEN + 1];
      uint8_t devIDAddr_Init[B_ADDR_LEN] = {0};
    
      bleAddress = *((uint64_t *)(FCFG1_BASE + FCFG1_O_MAC_BLE_0)) & 0xFFFFFFFFFFFF;
      devIDAddr_Init[0] = bleAddress & 0xFF;
      devIDAddr_Init[1] = (bleAddress >> 8) & 0xFF;
      devIDAddr_Init[2] = (bleAddress >> 16) & 0xFF;
      devIDAddr_Init[3] = (bleAddress >> 24) & 0xFF;
      devIDAddr_Init[4] = (bleAddress >> 32) & 0xFF;
      devIDAddr_Init[5] = (bleAddress >> 40) & 0xFF;
      util_arrtohex(devIDAddr_Init, B_ADDR_LEN, addrStr, sizeof addrStr, UTIL_ARRTOHEX_REVERSE);
      attDevName[13] = addrStr[9];
      attDevName[14] = addrStr[10];
      attDevName[15] = addrStr[12];
      attDevName[16] = addrStr[13];
      attDevName[17] = addrStr[15];
      attDevName[18] = addrStr[16];
    
      GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDevName); // Comment out or not

    But it still occur the same phenomenon:When I first scan the device, I can see  the right name "Type-2BE VSN <address>". But when I connect the device, then disconnect the device and scan the device again, the scanned name change to Type-2BE VSN. (Note my syscfg file has been changed to this name). I am confused why you can't reproduce this problem.

    Today I can see some clues in LightBlue App. When I comment out the above function GGS_SetParameter and I connect the device through LightBlue App, the screen shot is as follows(This situation is the only correct on my own):

    When I add the above function GGS_SetParameter(not comment out) and I connect the device through LightBlue App, the screen shot is as follows(This situation is the above problem):

    You can see the difference between these two sceenshots.

    If you can't reproduce this problem and comment out the GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDevName) doesn't bring side effect, I think I have to comment out it in original code to make this problem solved because this is my only method to work this around.

    Thank you very much for your patience.

    BRs.

  • Hello,

    I apologize for the delayed response! I reran the test and I'm having issues reproducing this problem. I do notice that our LightBlue interfaces slightly differ. I am using the latest version of LightBlue on Android. I wonder if this difference can be affecting our test results.

    I would thoroughly test if there are any side effects, however, I'm glad to hear that your workaround resolves this issue.

    Best Regards,

    Jenny 

  • Hi, Jenny:

    I have used LightBlue App on iPhone iOS not on Android. Thanks. But I still doubt there is some tricky modifications that you did but I didn't make.

    BRs.

  • Hi,

    If you needed to, please feel free to also send me a copy of your multi_role.c that I can drop into my project to test for you.

    For now I will mark both your workaround response and my response on how to modify the name as resolutions so people can reference both to help them get started on modifying the names.

    Best Regards,

    Jenny

  • Hi, Jenny:

    I have used the simple peripheral application example and my own simple_peripheral.c about advertisement is almost the same as the original simple_peripheral.c. In my opinion, it's ok to use the original simple_peripheral.c. Thank you for your generous help and patience. If you can't reproduce this problem, later if I have time, I will check this issue again. Now, I use the workaround method. Thank you again.

    BRs.