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

Adding DFU in custom application

Hi all,

There are lots of posts on the devzone about adding DFU service to a custom application and they have been very helpful in getting to this point.

At this point, I have an application that works very well on its own. Within this application I have defined a custom service with a 128-bit UUID. For adding the DFU service I am following the buttonless_dfu example (which works well on its own).

Now in the services_init() function when I call ble_dfu_init(&m_dfus, &dfus_init); and ble_ais_init(&m_ais, &ais_init);both, the application doesn't advertise anything. The log shows:

SDH:DEBUG:sd_ble_enable: RAM start at 0x20002128
:INFO:running nrf_dfu_settings_init
APP_ERROR:ERROR:Fatal

If I run the application with only the DFU service and do not initialise my own service, it does advertise. Similarly, if I init my own service only it works fine (functionally) without the DFU service.

The problem appears to be similar to these posts:

devzone.nordicsemi.com/.../

devzone.nordicsemi.com/.../

The two main solutions are to increment vs_uuid_count and/or to increase the GATT table size. I have tried the first one and that still results in the same problem. I don't know how to increase the GATT table size and what value should it be increased to. Additionally, I have updated my linker file with the bootloader settings section as well.

Can someone point me in the direction of how to go about finding the root cause of the problem here? I am using SDK 12.2 with nRF52832.

UPDATE:

I am getting an error code of 4, when doing the init of the second service (regardless of whether its the DFU or my custom one - even if I change their orders).

  • Hung

    Thanks

    It's my misunderstanding of the "DFU service", because when used by the application it's only a method to reset into the bootloader with the appropriate flags set to cause the bootloader to advertise etc as a the actual DFU service

    I generally incorporate the function of the Buttonless DFU command service into my own command system, rather than adding an additional service, because it takes more resources, and also takes up spare in the advertising packet which I need for broadcasting manufacturer data

    But I understand my response was confusing

  • You are right about the fact that the Buttonless DFU service has its sole purpose is to reset into bootloader. You can of course integrate it into your own service to trigger the command. But then you need to make your own app to do so. If you use the ready made DFU service , then you don't need to modify the DFU library on the Android/iOS app.

    I don't think you need to advertise the DFU service in your advertising packet. The DFU master detect if a device support DFU buttonless or not after service discovery, not when scanning.

  • Changing attribute table size seems to be helping so I think that's the problem.

Related