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'm glad that you found the issue. Can you do DFU now with the fix ?

  • Not exactly. Even though I was able to make it properly connectable, I was not able to perform DFU. It was crashing while performing DFU. I have however reached a solution. Earlier for the connectable mode,in the advertising_init function, I was not passing any advdata.uuids_complete.uuid_cnt and advdata.uuids_complete.p_uuids values, as there was no service other than the DFU.

    Thus when I included the NUS in my application and passed its adv_uuid values to the advertising init function, it worked fine without any issues.

    Is it mandatory to pass the uuid parameters in the advertising init function , for a proper connection? Or is it necessary to have a service present, other than the DFU.

    I am debugging the issue. It would be helpful if you could give me some suggestion..

  • No, it doesn't matter which UUID you advertise in the advertising packet. The way DFU buttonless works is:

    Device advertises (doesn't matter what in the advertising packet)

    DFU app connect, check if the DFU service is in the Attribute table

    DFU app enable CCCD and send DFU command (0x01) to the DFU control point

    Device disconnects and switchs to Bootloader

    Bootloader advertises.

    DFU app connect again to the bootloader and perform DFU.

    Could you debug and check at which step it's failed ?

    I would assume you have tested DFU with button (to switch to bootloader mode) and it worked, you managed to DFU update your application multiple times ?

  • I am using the button to switch to connectable mode.My application by default runs in beacon state.

    Yes, I was able to perform DFU multiple times.

    I am problem in the last two steps. After disconnecting and switching to bootloader mode, my device is not able to connect.It stucks somewhere in the connecting part. I am debugging it.

    However, I was able to resolve that issue by adding the NUS service and passing its uuid parameters. I was wondering, if it is necessary to pass adv_uuid, in the advertising init, when implementing connected mode.

Related