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.

CC2541: Communication between two devices

Part Number: CC2541
Other Parts Discussed in Thread: BLE-STACK

Hi!

I'm developing an application with two HM-11 modules that uses CC2541 MCU, the thing is that I need that one device control the other via BLE. In my case, when one GPIO of the central device change it's state it sends a message to the peripheral one to blink a LED. So, my doubt is how can I make this devices connect to each other without any visual interfaces like phones and other things?

Regards,

Bruno

  • I suggest you to start from SimpleBLECentral and SimpleBLEPeripheral examples in BLE-Stack to do this.

  • Hi Bruno,

    Please follow 's suggestions. Let us know if you need additional help!

    Regards,

  • Hi, Clément and Yikai!

    I loadead SImplePeripheral and SimpleCentral on two different devices, and configured the LEDs and a periodic task to each one in a way that I will be able to monitor pairing events. So, my doubt is if both devices are supposed to scan , advertise , pair and connect to each other automatically or must I do something in the codes to it happens?

    Regards,

    Bruno.

  • SImpleBLEPeripheral would do advertising automatically but SimpleBLECentral doesn't do scan and pairing automatically. You have to revise SimpleBLECentral by yourself. Adding GAPCentralRole_StartDiscovery at where you want to start scanning in your SimpleBLECentral application and do pairing in simpleBLEGATTDiscoveryEvent by yourself.

  • Hi!

    Thanks for the reply. Is there any implemantion example of this thing I'm trying to do? I've been reasearching for days and it seems that I will spend a lot of time to actually do it, but I'm in a hurry to make it work. If are there any examples of USB dongle implementation , it would be nice too!

    Thanks,

    Bruno

  • TI only provides generic examples to show you how BLE central and peripheral works. For specific purpose and customization, you have to do it by yourself.

  • Hi, Yikai!

    I added "GAPCentralRole_StartDiscovery()" to my periodic task and now I'm trying to see the scan results with the UART. So,after studying the simpleBLEcentral.c code and the software guide I concluded that I need to use  "simpleBLECentralEventCB( gapCentralRoleEvent_t *pEvent )"  function to get scan results via  simpleBLEScanRes variable , but I don't know how to use this function on my periodic task. What  simpleBLECentralEventCB(...) parameter should be passed?  Am I supposed to create an gapCentralRoleEvent_t struct or is it already done?

  • After you call GAPCentralRole_StartDiscovery and there is any device scanned, BLE stack would trigger "case GAP_DEVICE_DISCOVERY_EVENT:" in simpleBLECentralEventCB automatically.