Beware that this post is related to an SDK in maintenance mode
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

Buttonless DFU SDK 17.1

Hello,

I'm running Buttonless DFU successfully, but I would like to know if it is possible to start the application with the DFU service disabled, and activate it only later when receiving a certain command by UART. 

Basically, I want the Secure DFU Service, and Buttonless DFU Without Bonds, to be hidden and inactive, and after a command received on the UART, the service starts up and becomes visible. It's possible? How should I do this?

To activate DFU, I send 0x01 through the Buttonless DFU Without Bonds feature. In order for this value to actually be sent through the app to IOS nRF Connect, I must enable a double arrow icon in nRF Connect, why is this necessary?

I must send 0x01 through the "Buttonless DFU Without Bonds" feature signaling the device to enter DFU mode, it is possible to signal the device to enter DFU mode by sending this value, this signaling, through the NUS using "UART RX Characteristic" by example? If possible, what should I change?

Thank you very much.

  • Hi, 

    I would like to know if it is possible to start the application with the DFU service disabled, and activate it only later when receiving a certain command by UART. 

    Entering DFU mode is triggered by one of the optional sources:

    See Firmware activation

    To activate DFU, I send 0x01 through the Buttonless DFU Without Bonds feature. In order for this value to actually be sent through the app to IOS nRF Connect, I must enable a double arrow icon in nRF Connect, why is this necessary?

    Do you mean this  ? You need to Click the DFU icon to start the Device Firmware Upgrade process. This will open up a window where you can browse to and select a firmware upgrade package to program on the device.

    I must send 0x01 through the "Buttonless DFU Without Bonds" feature signaling the device to enter DFU mode, it is possible to signal the device to enter DFU mode by sending this value, this signaling, through the NUS using "UART RX Characteristic" by example? If possible, what should I change?

    You can add buttonless DFU to NUS. That will be simpler.  

    Regards,
    Amanda

  • First of all thanks for the response and support.

    Entering DFU mode is triggered by one of the optional sources:

    See Firmware activation

    I'm using the GPREGRET registry write method to get into DFU, but I do this through the "Buttonless DFU Without Bonds" feature. So I could just change it to write to the GPREGRET registry via the "UART RX Characteristic" feature. Would that work?

    Do you mean this  ? You need to Click the DFU icon to start the Device Firmware Upgrade process. This will open up a window where you can browse to and select a firmware upgrade package to program on the device.

    Not exactly, I'm referring to the flagged icon in the image below, why is it necessary to activate this button to allow this feature to send data?

    You can add buttonless DFU to NUS. That will be simpler.  

    I already have an application with DFU and NUS. But in this application I don't use NUS to enter DFU mode, I could then create another application without the DFU service and its "Buttonless DFU Without Bonds" feature and just modify the NUS application to write to the GPREGRET registry and reboot to enter the bootloader mode and receive DFU updates? Do you have an example of this? Thanks

  • Updating, I managed to get into DFU mode after receiving any data via "UART RX Characteristic", I just put the following calls inside the nus_data_handler() function:

    sd_power_gpregret_set(0, dfu | BOOTLOADER_DFU_START);
    NVIC_SystemReset();
    NRF_PWR_MGMT_HANDLER_REGISTER(app_shutdown_handler, 1);

    But that was just a way of seeing it work, as my intention is to switch to DFU mode only when receiving certain data. For example "123456".

    I want something like:

    if(RXdata = "123456")

    {

    sd_power_gpregret_set(0, dfu | BOOTLOADER_DFU_START);
    NVIC_SystemReset();
    NRF_PWR_MGMT_HANDLER_REGISTER(app_shutdown_handler, 1);

    }

    But I'm having trouble finding the variable where the data, the total string received by uart is stored, what function should I call instead of "RXdata" for this to work? Thank you very much.

  • Hi, 

    You can use strcmp to compare the RXdata against the string command in the nus_data_handler() function as the following:

    uint8_t const * p_command =  p_evt->params.rx_data.p_data;
        if (p_evt->type == BLE_NUS_EVT_RX_DATA)
        {
            if (!strcmp(p_command, "123456"))
            {
                NRF_LOG_INFO("Command 123456 received");
            }

    Remember that 'p_command' must be NULL terminated for this to work.

    -Amanda

Related