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.

LAUNCHXL-CC2640R2: Switching GAP roles during runtime (not Multi-Role)

Part Number: LAUNCHXL-CC2640R2


I am trying to figure out how to use the GAP API to switch roles during run time.

My device will start up in a peripheral role and allow connections. When not in a connection, the device will switch between observer and broadcaster based on commands received over a serial port. Can I just call GAP_DeviceInit() each time I want to switch roles? or will I have to reset the device? Are there any examples of this? 

  • Hello. There is an old example for the CCC254x here: processors.wiki.ti.com/.../MasterSlaveSwitch. Most of this still applies.

    You have the correct idea that you just need to call GAP_DeviceInit(). You also need to ensure that you have all the correct code linked in to begin with and have the correct tasks added to OSAL. You can see this in the example. For the CC2640R2, you'll also need to update the build_config.opt file to link in the correct libraries.