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

buttonless DFU and NUS

Hi !

I am on a firmware project for a nrf52832. I am using SES on Windows. 

There seem to be a problem when combining buttonless DFU and NUS. When I do the services_init, I have to choose if I call 'ble_dfu_buttonless_init' or 'ble_nus_init'. If I call both, one of them raise an error in the ERROR_CHECK. 

I would like to now how to enable NUS and buttonless at the same time.

Thanks !

  • The error is NRF_ERROR_NO_MEM that is raised from 'ble_nus_init' when it is called after 'ble_dfu_buttonless_init'

  • Hello,

    Can you please check what function inside ble_nus_init() that returned this?

    Not just inside the ble_nus_init() function, but keep digging until you find the softdevice call (sd_...()) that returned this value (4).

    The main suspect is that you need to increase the NRF_SDH_BLE_VS_UUID_COUNT from 1 to 2 in sdk_config.h.

    At least if it is the sd_ble_uuid_vs_add() that returns 4.

    BR,
    Edvin

  • Hi Edvin, 

    Thanks for your answer. You are right, I switched the NRF_SDH_BLE_VS_UUID_COUNT to 2 and had to move RAM start and size, now it works ! 

    Now, when I am avdertising, I am able to perform buttonless DFU with nrfToolbox. That part works fine. 

    The reason why I am using NUS is for a central to connect with the device and exchange data with the device. However, even though I see it advertising, the central does not connect like it used to before I setted up DFU. Is it anything else I need to change ?

    I suspect that part of the code to play a role : 

    ble_uuid_t m_adv_uuids[] =                                          /**< Universally unique service identifier. */
    {
        {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE}
    };

  • Added this information to the uuids.. didn't work either.

    ble_uuid_t m_adv_uuids[] =                                          /**< Universally unique service identifier. */
    {
        {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE},
        {BLE_UUID_DEVICE_INFORMATION_SERVICE, BLE_UUID_TYPE_BLE}
    };
    

  • JayLynkz said:
    However, even though I see it advertising, the central does not connect like it used to before I setted up DFU. Is it anything else I need to change ?

     That is probably because of the central's selection of who to connect to. Do you see the advertisements from the peripheral using e.g. nRF Connect?

    What is your central in this case? What sort of filters does it use to decide who to connect to? And what SDK version do you use (just in case it is relevant later).

    I'll assume you are using the ble_app_uart_c as a central. I'll refer to SDK 17.0.0 for now:

    You can see in scan_init(), it sets up a filter for the UUID for the NUS. Does your advertisement contain the NUS service's UUID?

    BR,

    Edvin

Related