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

How to make beacon connectable

Hi Nordic,

I am trying to implement DFU-OTA in beacon. For that I am trying to make beacon connectable. My requirement is to work the beacon in non-connectable mode during normal operation whereas for implementing DFU, I need to make it connectable by using a button press.

What I have implemented - when a button is pressed, I stop the advertising and start the connectable advertising.

Issue faced- I am not able to perform DFU. My reasoning is that, since I have copied the DFU relevant code snippets from working example code, there is nearly no chance of error in DFU part. So I am guessing the issue lies with transition from non-connectable to connectable mode.

Is my implementation for connectable mode correct?If there is a better way of implementing the following, please suggest..

  • I have already implemented as given in the documentation. I am able to connect to the beacon, but when I try to perform DFU, I am having the problem....

    For the DFU using button, I will try and let you know..

  • You need to debug in more detail. Switching from application to bootloader mode is pretty straight forward. The DFU control point should have CCCD enabled, then 0x01 being written to the control point. The application then switch to DFU bootloader.

  • Hi Hung,

    For debugging purpose, I am tried to make beacon by default in connectable mode.Thus I replaced the BLE_GAP_ADV_TYPE_ADV_NONCONN_IND in the advertising_init() with BLE_GAP_ADV_TYPE_ADV_IND. But when I do this , the device stops advertising, whereas when I change it back to non-connectable, its advertising. For further surety, I added all the connection related parameters and functions(conn_params_init()).

    Can beacon be made connectable at all? If so, is button based DFU the only solution for implementing DFU-OTA in beacon?

  • Please try to debug and see why it stopped advertising. Most likely the parameter was not correct for doing connectable advertising. You need to figure out which function return error.

    I don't see why you can't advertise in connectable mode. But note that advertising in connectable mode is just one condition, you need the DFU service to switch from application to bootloader.

  • Hi Hung, Thanks.I debugged the problem. The issue was due to the advertising init function called inside the for loop. Although the device switched from non-connectable to connectable mode,before the whole transition, it jumped back to non-connectable mode due to the advertising init function. It worked fine after I prevented the following by using a flag variable.

Related