Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE connection

Hello,

       We wish to use nRF52832 IC in our design. We will design an equipment which can connect to another device via BLE and can send some measurement data. Our equipment will be the BLE client. 

      In the nRF5_SDK there are many examples such as uart example. However this is example is not suitable for our needs. In this example nRF52832 acts like a server. We need a client example. For this purpose, Which example do I need to use ?

Best Regards

Parents
  • Please use terminology like "central" and "peripherial" with BLE, as "client" and "server" is ambigous here. There are example codes for both central and peripherial role using UART service.

  • Hello,

          I am not familiar with the BLE terminology That's Why I am explaining it by the awkward way. I see that server is named as central and the client is named as peripheral in BLE jargon.

          When I use the code below, will my nRF52832 connect to any BLE device?   

          "C:\nRF5_SDK\examples\ble_central\ble_app_uart_c"

  • Hi,

    Using BLE terminology, that example (Nordic UART Service Client) is a "central", which is also the device initiating a connection. It does so by entering the "scanner" role, which is where it listens for "advertisements" from a "peripheral".

    In this particular example it checks if the peripheral advertises a specific BLE Service (the Nordic UART Service) and connects to any peripheral that do. This is done in the advertisement report handler named on_adv_report() found in main.c.

    For better understanding the concepts and terminology involved in BLE, I strongly recommend having a look at the tutorials here on DevZone, especially the bluetooth low energy tutorials. They will introduce you to some concepts and terminology that makes things much easier both for asking further questions and during development.

    Regards,
    Terje

Reply
  • Hi,

    Using BLE terminology, that example (Nordic UART Service Client) is a "central", which is also the device initiating a connection. It does so by entering the "scanner" role, which is where it listens for "advertisements" from a "peripheral".

    In this particular example it checks if the peripheral advertises a specific BLE Service (the Nordic UART Service) and connects to any peripheral that do. This is done in the advertisement report handler named on_adv_report() found in main.c.

    For better understanding the concepts and terminology involved in BLE, I strongly recommend having a look at the tutorials here on DevZone, especially the bluetooth low energy tutorials. They will introduce you to some concepts and terminology that makes things much easier both for asking further questions and during development.

    Regards,
    Terje

Children
  • Hi tesc,

         I will take a look at the that you provided.

         For my early question, Which example should I use? My BLE device will connect to another BLE device such as PC or tablet. My device will be the client.

  • Hi,

    BLE does not have a concept of client and server, in the way many other protocols have.

    In a BLE connection, you have one device which uses very little power (peripheral) and one device which usually uses more power (central). Data can be sent in any direction between the two, and in that sense both can act in a way that you can describe as being a kind of "client" and a kind of "server".

    You probably want to let your device be the peripheral. If you only need a connection once in a while, then the peripheral can start advertising when it needs a connection. The PC or tablet, acting as central, must scan all the time, and when it receives an advertisement from the peripheral it can connect and receive data from the peripheral over the connection.

    Alternatively you can do this without using a connection, if your device is a broadcaster (beacon) that advertises and has put the data directly in the advertising packet. The PC or tablet in this case acts as observer, and data can only go from the beacon to the observer (no data the other way, for that you would need a connection.)

    Regards,
    Terje

Related