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

DFU programming

Hi everybody,

I am trying to program a custom board via DFU without success. I can build bootloader and zip file. I can even program the file by nRFToolbox on device but it does not work after programming.

Now my questions are:

1- Should I build the bootloader with my custom board or with a standard board files?

2- what about CONFIG_NFCT_PINS_AS_GPIOS? Where should I define them? In bootloader and application options?

Parents
  • Hi,

    I have a few questions:

    • Does the DFU operation complete successfully when you do it from nRFToolbox?
    • In what was do you see that it does not work after programming? Does the device stay in DFU mode, or in some other state?
    • Can you try the debug bootloader with RTT logging, and upload the logs here? That should give a good indication about what is happening.

    Regarding your specific questions:

    1. If the board file reflects the parts your HW that is used by the bootloader correctly (LEDs and buttons), then there is no need to change. If not, then you should use a custom board file (or adapt the board file you are using, though it is somewhat dirty).

    2. Having CONFIG_NFCT_PINS_AS_GPIOS set causes the firmware to set the correct UICR register to indicate that the NFC pins should act as normal GPIOs. That only has to happen once (it is essentially a write to flash, you can see the implementation in system_nrf52.c). Therefor it does not matter unless you use one of the NFC pins for something in the bootloader (which runs first).

  • Thanks for reply. Here-below the my answers:

    - Yes. I receive the massage : DFU Upload compelete.

    - It is still staying in DFU mode. I can repeat Firmware Update via nRF toolbox.

    - How can I generate log file? I have already compiled pca10040_ble_debug project. How can I generate log file?

    I used my own cus_board.c and cus_board.h based on defult board.c and board.h. I modified LED and buttom numbers and pins. The custom boards has only 1 buttom connected to reset pin. I could not have used reset pin as GPIO yet.

    I am using nRFgo Studio to program softdevice and keil to develop and program the application. Everything is working without DFU.

  • Hi,

    Can check the bootloader logs? The reason for entering DFU bootloader is logged in dfu_enter_check() in nrf_bootloader.c (assuming SDK 15).

  • 0537.log.txt

    Here is the log file:

    1- firmware uploaded

    2- turn off-on the board to run the application

    3- waiting for sleep mode of application:

    static void sleep_mode_enter(void)
    {
    ret_code_t err_code;

    err_code = bsp_indication_set(BSP_INDICATE_IDLE);
    APP_ERROR_CHECK(err_code);

    // Prepare wakeup buttons.
    err_code = bsp_btn_ble_sleep_mode_prepare();
    APP_ERROR_CHECK(err_code);

    // Go to system-off mode (this function will not return; wakeup will cause a reset).
    err_code = sd_power_system_off();
    APP_ERROR_CHECK(err_code);
    }

    4- push the button to wake the application up

  • Hi,

    You can see from the log that the GPIO pin used to enter DFU mode is asserted:

    00> <debug> app: DFU mode requested via button.

    If you do not use the same button for wakeup as to signal enter DFU mode, then this indicate that you have an issue with your bootloader configuration or perhaps a HW issue with the DFU enter pin (floating?).

    If you are pushing the same button as you use to enter DFU mode to wake up the device, then this is expected behavior. You either need to use a different button to force DFU mode (if you have more), use buttonless DFU, or expand the DFU button enter check to for instance require the button to be pushed for a certain duration of time for it to enter the DFU mode (or other alternatives).

  • Hi,

    Where can I assign DFU  mode button?

    Is DFU mode activated by reset?

  • Hi,

    DFU is not activated by reset itself, but the bootloader runs after every reset and checks if any of the mechanism uses to signal DFU is enabled. According to your log, the GPIO pin configured to signal that you want to enter DFU mode is asserted. The bootloader will check the GPIO pin defined by NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN in the bootloader projects sdk_config.h if NRF_BL_DFU_ENTER_METHOD_BUTTON is set to 1.

    If you don't want to use a GPIO pin to signal DFU mode, set NRF_BL_DFU_ENTER_METHOD_BUTTON to 0. If you just want to use a different pin, set NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN accordingly.

Reply
  • Hi,

    DFU is not activated by reset itself, but the bootloader runs after every reset and checks if any of the mechanism uses to signal DFU is enabled. According to your log, the GPIO pin configured to signal that you want to enter DFU mode is asserted. The bootloader will check the GPIO pin defined by NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN in the bootloader projects sdk_config.h if NRF_BL_DFU_ENTER_METHOD_BUTTON is set to 1.

    If you don't want to use a GPIO pin to signal DFU mode, set NRF_BL_DFU_ENTER_METHOD_BUTTON to 0. If you just want to use a different pin, set NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN accordingly.

Children
Related