nRF5 SDK is not maintained anymore
More Info: Consider nRF Connect SDK for new designs
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ble connection sequence

HI,

I am developing an application which requires BLE connection. I am concerned about the energy consumed by the device during the connection.

I understand that once the connection is established there will be EXHANGE MTU and Discovery sequence ? Is this mandatory ? How can we keep the connection sequence to minimal ?

I am attaching the log file from sniffer and I observe many packets between master(nRF Connect) and slave ? Is this normal ? Can we optimize this if we develop our own master/client application?

Parents
  • Hello!

    When establishing a connection some packets will be sent back and forth between the central and peripheral to configure the connection properly.

    In the simplest case this could be just a connection request packet from the central to the peripheral, but often more packet exchanges are needed.

    For example an MTU exchange, which sets the Maximum Transmission Unit, allowing for more data per packet.

    The discovery sequence on the other hand is done before establishing a connection, and involves the central unit choosing what advertising peripheral to connect to.

    All this is mandatory to set up a connection, but shouldn't be of great concern when it comes to energy consumption, as it only happens once at the beginning of a connection.

    Then there are all the empty packets you have observed being sent between the central and peripheral.

    These are sent regularly in order to keep the BLE connection alive, at a frequency set by the connection interval, which is decided by the central in the initial connection request.

    The connection interval seems to be set to a low value in your application since these packets are sent pretty frequently. It can be set to as high as a few seconds I believe.

    Setting a higher connection interval will likely make your application consume less power since it's sending fewer packets, but you might also find your application less responsive if you set it too high.

    Hope this clears up some of your questions.

    Best regards,

    Einar

  • Hi, 

    Thank you for your reply.

    The discovery sequence on the other hand is done before establishing a connection, and involves the central unit choosing what advertising peripheral to connect to.

    Oh sorry, I meant GATT database discovery which happens after the connection. Is this really needed if the client already knows the UUID of the characteristic being used ? Can client read/write using the UUID without the handle ?

  • Hi,

    There are many options in the Zephyr Bluetooth GATT API, maybe this function can suit your needs?

    What code are you currently running? Have you based your application on a sample?

    -Einar

Reply Children
  • What code are you currently running? Have you based your application on a sample?

    \examples\ble_peripheral\ble_app_template - My application is based on ble_app_template.

    I am just analysing the energy consumed during the connection.  

  • Right, I assumed you were using NCS, but you're using the nRF5 SDK?

    The ble app template is for an advertising peripheral, so I assume you're using nRF Connect as your central unit when testing to connect to your devkit?

    In that case, your DK will only do what the central tells it to, it's always the central unit that initiates things like GATT database discovery etc, so if you want to test with your own custom application at both ends that might be easier to do with two devkits for example.

    Also, as I already mentioned, this initial setup communication is not what you should be worried about when it comes to your application's power consumption.

    -Einar

  • In that case, your DK will only do what the central tells it to, it's always the central unit that initiates things like GATT database discovery etc, so if you want to test with your own custom application at both ends that might be easier to do with two devkits for example

    That's clear, thank you.

    Also, as I already mentioned, this initial setup communication is not what you should be worried about when it comes to your application's power consumption.

    That's correct, but my system is based on energy harvesting and hence this is very important for me. Also do you think if there is any way to transfer data (2-3 MB) between two devices without a connection ? Because, connection procedure seems to be very power hungry for us.  Is there any proprietary protocol available ?

  • When you are running your own applications on both sides of the connection, you might be able to "skip some of the steps" in the connection procedure, since you know beforehand what device you are looking for, if that makes sense. For example if your devices are bonded they can skip the pairing process etc.

    If you want to transfer data without establishing a connection, one way to do this is to set up your peripheral as a beacon, meaning it will only send advertising packets that your central unit can read without going through the connection procedure. This could end up making your peripheral use more power in the long run though, as it will have to send data regularly even if the central isn't reading it, but it could make your central unit use less power, so depending on where you need to save power this could be a solution. Be aware this setup could also make your transmissions less reliable, depending on how often your beacon advertises.

    If you don't want to use BLE, one option is to use the proprietary protocol ESB. You can find example code documentation here. Be aware that setting up ESB in your application will probably be more difficult than using BLE.

    Hope this helps,

    Einar

Related