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.

Parents
  • 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

Reply
  • 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

Children
No Data
Related