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.

MAsterSlaveSwitch doesn't work?

Other Parts Discussed in Thread: CC2540

I need my device to switch roles between peripheral and master, just like in the MasterSlaveSwitch example. However, when I load the compiled MasterSlaveSwitch code on the fob, I see the initial advertising but when I press the button to switch role to central, I don't see any advertising being received. Furthermore, when I press the button again to switch back to peripheral, I don't see any advertising going out either :-(

Has anyone seen this example working?

Working with CC2540, BLE stack v1.2.1

Thanks,

Tom

  • Hi Tomer,

    What do you mean with "switch role to central, I don't see any advertising being received"? Where do you expect those to be presented?

    In order for the Master role to work, you'll need an advertiser (another device) to connect to. It would be nice if you could describe your issue a bit more thoroughly. 

    Best Regards

  • Thanks for picking this up Nick. Let me describe my setup in more details. I'm running the MasterSlaveSwitch code on the fob, and BTool on the USB dongle. When the MasterSlaveSwitch code starts to run, I can see the advertising messages from the fob received by the dongle/BTool. Then I press the button to change role to Central and set BTool to act as a Peripheral and send advertising messages. At this point I expects to receive GAP_DEVICE_INFO_EVENT in the fob but I never receives it. I do receive GAP_DEVICE_DISCOVERY_EVENT after a few seconds with 0 new devices.

    When running the same steps on BTool to make it advertise with SimpleBLECentral running on the fob, I get the GAP_DEVICE_INFO_EVENT as expected and GAP_DEVICE_DISCOVERY_EVENT shows 1 discovered device. So I'm certain that my BTool configuration is correct.

    Something I just discovered yesterday - calling LL_Init() again just before switching roles (before calling GAP_DeviceInit() with GAP_PROFILE_CENTRAL) fixes the problem!! So seems like I can move forward with my code but still curious if this is a potential bug in the BLE stack.

    --Tomer

  • Hi Tomer,

    That's really weird, I have not heard of that problem (nor the solution/workaround) before. I will hopefully have time to take a closer look on it soon, in the meanwhile it looks like you have a working solution :)

    Best Regards.