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

With Butonless DFU "bootloader_secure_ble" geting out DFU mode

Hi

I did DFU with button, i can enter and load zip pack over nrfToolbox mobile.

I tried butonlessDFU, i copied services "experimental_ble_app_buttonless_dfu" and with sending request device enter to boot but jump back apk quickly with a reset.

With buton i hold pushing more so continues bootcode but with butonless after reset, i think NRF_POWER->GPREGRET became 0.

I use SDK13.0 "bootloader_secure_ble" code and almost orginal.

Another issue, I couldnt get BLE_GATTS_EVT_HVC event with nrfconnect, so i add (void)bootloader_start(); to BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
This works but as i told jumping back to apk about 3sec.

void ble_dfu_on_ble_evt(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt)
{
    VERIFY_PARAM_NOT_NULL_VOID(p_dfu);
    VERIFY_PARAM_NOT_NULL_VOID(p_ble_evt);

    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            on_connect(p_dfu, p_ble_evt);
            break;

        case BLE_GAP_EVT_DISCONNECTED:
            on_disconnect(p_dfu, p_ble_evt);
            break;

        case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
            //(void)bootloader_start();
            NRF_POWER->GPREGRET = 0xB1;
            NVIC_SystemReset();
            on_rw_authorize_req(p_dfu, p_ble_evt);
            break;

        case BLE_GATTS_EVT_WRITE:
            on_write(p_dfu, p_ble_evt);
            break;

        case BLE_GATTS_EVT_HVC:
            on_hvc(p_dfu, p_ble_evt);
            break;

        default:
            // no implementation
            break;
    }

}

Regards

Ferhat

Parents
  • Hello,

    Out of curiosity, where is this snippet fetched from? Which SDK do you use, and is this from the ble_app_buttonless_dfu example?

    However, If the error is related to writing to NRF_POWER->GPREGRET, it might be that the writing is not finished before you reset. You can try to add a short delay before you call NVIC_SystemReset();

    Try to read the register, and call add a while loop while the GPREGRET is not the correct value.

    But why did you need to change this? I am not too familiar with the bootloader source code, but did it not work, or do you want to something else?

    Best regards,

    Edvin

  • Im using SDK 13, Code snipnet fetced from ble_dfu.c.

    I copied dfu service from "experimental_ble_app_buttonless_dfu" and add to my main.c

    I can enter boot area with using with "(void)bootloader_start();" method

    Or i can enter boot area with using two lines below;

    NRF_POWER->GPREGRET = 0xB1;
    NVIC_SystemReset();

    ----------------------------------------

    So i dont have problem jumping bootaddress.

    I have led blink in "bootloader_secure_ble" loaded in bootloder area, Im understanding jumping boot success when with this blinking. Below code snipnet from "nrf_dfu.c"

    static void wait_for_event()
    {
        // Transport is waiting for event?
        nrf_gpio_pin_write(14,1);
        while(true)
        {
            // Can't be emptied like this because of lack of static variables
    #ifdef BLE_STACK_SUPPORT_REQD
            //(void)sd_app_evt_wait();
    #else
            __WFI();
    #endif
            app_sched_execute();
            Blink01();
        }
    }
    

    GPREGRET = 0xB1 control pass one time  with nrf_dfu_enter_check(). I think after 2-3 second, makes a reset but i think NRF_POWER->GPREGRET not still 0xB1.

    So my problem is in "bootloader_secure_ble" where bootloader area loaded.

  • Hello Edvin, please help. My previous message and this one.

    I prepared zip package for "ble_app_buttonless_dfu" example, and used evaluation board as hardware.

    I loaded with nRFConnect with using button for entering bootloader.

    I can not achieve description told in picture below.

    There is only Secure DFU Service and I can send Command or Request. No palce to enter that values 0100 or 01.

    When i connect with nRFConnect Led1 in ON

    When i send request Led1 goes OFF than start blinking. And disonnection happen.

    For command nothing happens.

    Regards

    Ferhat

  • Hello Edvin

    I found the reason, I have WDT in my apk and  still countsafter jumping bootloader.

    I have another issue, please answer, two days passed you replied.

    How can i make faster connecting DFUTarg.

    If i pass DFU mode with button it takes 2sec to connect to DFUTarg.

    if i pass DFU mode with butonless with Sending Request it takes up to 15sec

    and if i cancel in that while nrf52832 still stay connected. Im closing mobile phone BLE and turn on again than being available.

    Regards

    Ferhat

  • Sorry for the late reply, Ferhat! I have been out of office this week.

    Yes. The WDT will still count after switching to bootloader. Once started, you can't stop it. The only way to stop it is a power cycle. (Power off -> Power on).

    Do you have bonding required in your bootloader?

    You say that you "use SDK13.0 and 'bootloader_secure_ble' and almost original". What have you changed?

    Regarding where to write 0100 and where to write 01, there is actually described wrong. You should write 0200 to the client characteristics configuration, and 01 to the Secure DFU characteristics.

    Alternatively, just press the "play button", and write 01 to the characteristics. 

    If you do this, the device will disconnect, and start advertising as DfuTarg instead. The reason why it takes so long is probably because of the timeout waiting to happen before it starts to scan again.

    If you use the DFU icon in the top right corner, next to the settings icon, it will disconnect and connect to the DfuTarg immediately.

    Are you using the nRF Connect app? Desktop or Mobile? Or are you implementing your own DFU app?

    If you use a custom app, it is worth knowing that the device will advertise as DfuTarg once you write 1 to the Buttonless Secure Dfu without bonds service. It will advertise with bluetooth address 1 higher than the address that the Nordic_Buttonless advertised with. So in my case, it will use D4 instead of D3.

    Best regards,

    Edvin

  • if I want to exit boot without update in boot mode,how to change?use sdk13.0 dfu demo code。

  • When do you want to exit without update? When you get a disconnect? If you have a valid application? if the WDT times out?

Reply Children
No Data
Related