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.

CC2640: Setting scan response ID after starting the device

Part Number: CC2640

Hi,

I can change the scan response ID before starting the device with GAPRole_SetParameter(GAPROLE_SCAN_RSP_DATA, ...)  but cannot change it after starting.

Can I do this by stopping the device, making the change and restarting?  I don't see which functions to call to do this, can you help me?

Desired Flow:

1. Set a default scan ID

2. Start device (scannable)

3. New ID received via serial port

4. if currently no connection, Stop Device,  Set new ID, restart device (scannable)

Thanks,

Mark

  • Mark,

    Can you clarify what you mean by scan ID? are you meaning scan response data?

    If so, use GAPRole_SetParameter() using the GAPRole Param: GAPROLE_SCAN_RSP_DATA

    dev.ti.com/.../group___peripheral.html

    This function will handle the scan response update and automatically call the proper GAP function (GAP_UpdateAdvertisingData) for you.

    More info on GapRole:
    software-dl.ti.com/.../gaprole.html
  • Can you clarify what you mean by scan ID? are you meaning scan response data?

    --> YES, the scan response data


    If so, use GAPRole_SetParameter() using the GAPRole Param: GAPROLE_SCAN_RSP_DATA

    --> I'm doing this, as described in my post. I can successfully change the scan response data before starting GAP but not after.



    dev.ti.com/.../group___peripheral.html

    This function will handle the scan response update and automatically call the proper GAP function (GAP_UpdateAdvertisingData) for you.

    More info on GapRole:
    software-dl.ti.com/.../gaprole.html


    --> I have been through all of this and the sourcecode and none of this answers my question which is about SETTING THE SCAN RESPONSE DATA STRING AFTER THE DEVICE HAS STARTED (beaconing or advertising? I am not sure of the proper nomenclature but I am talking about once the device appears on "BLE SCANNER" app - I want to change the name of the peripheral device as seen here).

    Calling GAPRole_SetParameter(GAPROLE_SCAN_RSP_DATA, ...) seems to have no effect AFTER starting the device (i.e. after SimpleBLEPeripheral_init() is called and the GAP/GATT tasks start doing their thing.

    Regards,
    Mark
  • Mark,

    Where are you calling GapRole_SetParameter( GAPROLE_SCAN_RSP_DATA , xxx) in your application during run time?

    Just as a helpful tool for learning, it may be good to run through the SimpleLink Academy on Scanning and Advertising: dev.ti.com/.../ble_scan_adv_basic.html

    No means a requirement though!

  • I have only been successful with GapRole_SetParameter( GAPROLE_SCAN_RSP_DATA , xxx) when I call it before BIOS_start().

    I have played with the RTOS quite a bit, trying such things as:

    1) holding off on starting the BLE tasks until the value is set
    2) setting the GAP task priority to -1 until the value is set
    3) pausing the RTOS setting and restarting
    4) Turning off advertising until the value is set
    5) etc.

    No matter what I do, once BIOS_start() is called I cannot change the value.

    I thought about storing the value in FLASH and resetting, but that puts us back in the bootloader (by design, for field upgrades).

    I think there is something I need to do to "push" the change to GAP but I do not see it. Maybe one of the BLE stack guys can answer this?
  • Mark,

    Rest assured, every TIer responding to your posts is a BLE stack/applications engineer at TI.

    A few things. First, are you using the CC2640 or the CC2640R2F? They have different SDK's. I'm going to assume that you are using the CC2640R2F for this, with the most recent SimpleLink SDK (v1.50), but most of this will apply to either device (CC2640 or the CC2640R2F).

    1) I don't recommend calling this before BIOS_start(). main.c and the corresponding main() should only really be used for setting up tasks, initializing and what not.
    2) I don't recommend changing the priority of the GAP task. I also don't believe we even support a -1 priority (which would be the lowest priority of the system anyways). 1 is lowest, 6 is highest and in the course of BLE we only support a max of 6 priorities, the highest of which needs to be the iCall task.
    3) Pausing the RTOS and restarting it is not recommended as this highly disrupts the BLE stack and violates the BLE protocol timing, which leads to completely unpredictable operation.

    What I recommend you doing, is to start with a clean version of the simple_peripheral example in the CC2640R2F SimpleLink SDK. Run the example as normal, and try calling GAPRole_SetParam(GAPROLE_SCAN_RSP_DATA, xxx); from the SimpleBLEPeripheral_performPeriodicTask() function. Similar to how it's done in Task 2 for Advertising of the following lab I linked in a previous post and now below.
    dev.ti.com/.../ble_scan_adv_basic.html

    Adjust the new scan response data with your own scan response data. in the course of this, do not adjust priorities of the tasks or call GAPRole_SetParam prior to BIOS_start.