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.

Multi-role Support

Other Parts Discussed in Thread: CC2540

I have a "monitor" device which at the moment is a BLE Central role device which collects data.

I also have a "communicator" device which at the moment is a BLE Peripheral which recieves data from the montior and forwards it on to other systems.

I have chosen this architecture as the monitor needs to be able to "push" data out but is also running from a small battery. It therefore is the master and opens a connection to the communicator and sends data when it needs to. The communicator is constantly advertising.

This system works well, but there is a case where the monitor needs to be able to send data to a smartphone instead. For this to work as far as I understand the monitor would need to become a peripheral.

If the monitor becomes a peripheral, the smartphone would need to regularly connect with it to determine if there is new data to send, but this may compromise battery life.

The V1.2 stack release notes state:

 The BLE stack can now  support simultaneously advertising and/or scanning while in a connection as
either a master or a slave. This allows for a central device to perform device discovery while in a connection.

Does this mean a device can be both a central and peripheral role device?
  • Hi,

    I'm also looking for a similar application. I need to make a bluetooth mesh, but central device is not pre-decided. So the roll needs to be selected at the start. 

    Is it possible to start the CC2540 in peripheral role and then switch to the server role, if it finds no central devices to connect to? 

    I would be using the UART interface to interact with the CC2540.

    If someone has any examples to do this, kindly share.

    Thanks

  • Eng351 said:

    This system works well, but there is a case where the monitor needs to be able to send data to a smartphone instead. For this to work as far as I understand the monitor would need to become a peripheral.

    Yes, you would be correct in that regard. Smartphones use dual-mode Bluetooth solutions, and that in a sense forces them to become the master or central device (done to control timing as well with the underlying OS).

    Eng351 said:

    Does this mean a device can be both a central and peripheral role device?

    That is indeed true, although not at the same time. You can do advertising type events (peripheral) as a central device or you can do scanning type events (central) as a peripheral device.

  • Akshat Bisht said:

    Is it possible to start the CC2540 in peripheral role and then switch to the server role, if it finds no central devices to connect to? 

    There is an example on TI's wiki page that allows the keyfob to switch between central and peripheral modes using one of the push buttons to do so.

    http://processors.wiki.ti.com/index.php/MasterSlaveSwitch

    You may be able to modify that code to perform the tasks you are seeking.

  • Misael said:

    Is it possible to start the CC2540 in peripheral role and then switch to the server role, if it finds no central devices to connect to? 

    There is an example on TI's wiki page that allows the keyfob to switch between central and peripheral modes using one of the push buttons to do so.

    http://processors.wiki.ti.com/index.php/MasterSlaveSwitch

    You may be able to modify that code to perform the tasks you are seeking.

    [/quote]

    Thanks, Ill take a look at that.

  • Thanks a lot for the answer.

    One more question, is it possible to take the SimplePeripheral and add simple controls using UART/SPI, such as changes values in GATT registers?

    I don't want to migrate the whole application to the main processor, and use the HostTest application.

    Thanks