This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to enable bidirectional comunication on my nrf51822

Hi,

I'm using the nrf51822 and I want to merge Server and Client roles in one Peripheral device. I am already able to send a history of temperature and humidity measurements to my phone, but I don't have possibility to set measurement period in my phone and send this parameter to nrf51. It seems to me that only reasonable way to do it is to convert GATT role of nrf51, to be Server and Client in the same time. In other words, besides sending characteristics from nrf51, I also must read them. Unfortunately, I can't find any example or even clues how to do it. Only example that brings up the issue of setting GATT role is that one: devzone.nordicsemi.com/questi... but it relates to other SoftDevice, and purpose of this application is quite different. I use S130 SoftDevice and SDK 11. I would be grateful for any advice.

Parents
  • Hi!

    we also use S130 to act as peripheral and central at the same time.

    You have to start scanning as well as setup advertising. Stack will automatically listen for connects 8=>on_connected event) and you can perform your own connects when you receive an advertising event.

    When you receive a CONNECTED event, you can check your role - e.g.:

    if(p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_PERIPH) {
    // we are peripheral
    } else {
    // we are central
    }
    

    greetings, Michael

  • Every connection event consists of data package sending from central to peripheral and other package sending after T_IFS period from peripheral to central. The peripheral doesn't hold a monologue so it is definitely possible to receiving some data from central, and GATT roles (Server and Client) are not fixed to GAP roles (Central and Peripheral). I just don't know how to make use of this knowledge in practice

Reply Children
No Data
Related