This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

firmware update without button press?

Hi,

Can anyone please tell me the exact way to enter into the bootloader mode by writing some characteristics with specific value.

I tried setting NRF_POWER->GPREGRET register in the sample ble_app_hrs code, whenever the write event with specific handle occurs, as follows

static void on_write(ble_evt_t * p_ble_evt) { ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; if (p_evt_write->handle == 3) // device name handle { NRF_POWER->GPREGRET = 1; sd_nvic_SystemReset(); }

And also did changes in the bootloader code as follows,

if (bootloader_is_pushed || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START)) || NRF_POWER->GPREGRET == 1) { nrf_gpio_pin_set(LED1); NRF_POWER->GPREGRET = 0; // Initiate an update of the firmware. err_code = bootloader_dfu_start(); APP_ERROR_CHECK(err_code);

nrf_gpio_pin_clear(LED1); }

i got all this info from this forum only, but it is not working for me, please suggest me what i need to do to make it work. Please provide some alternative logic's also.

And in debug session device enters into the dfu mode, but in normal mode it is not working.

Regards, Balaji

bootloader_error.png

  • Hi Balaji,

    When softdevice is enabled NRF_POWER is not directly accessible. You need to use sd_power_* api to access. For NRF_POWER->GPREGRET, you need to use sd_power_gpregret_get and sd_power_gpregret_set.

    In the bootloader, since the softdevice is not enabled, you can use NRF_POWER->GPREGRET directly.

  • Thanks for your reply, Now the problem i am facing is my device is always in dfu mode, i am not sure whether it is because of sd_power_gpregret_set or not. Now i am not able to enter into the application after i flash the bootloader code into my device. If possible please tell me the reason why it is happening. I did entire chip erase and flashed the fresh sample codes of both heart rate and bootloader, without bootloader my application is working fine, once i flash the bootloader it is always in bootloader mode.

  • @Balaji: How did you flash the application code? It will not work if you flash the application directly using Keil or nrfjprog. You need to use the bootloader to update (write if it is the first time) the application code. The reason for that is that the bootloader always check for 1 byte on the flash (at BOOTLOADER_SETTINGS_ADDRESS) to make sure that the application code is valid. Please refer to bootloader_app_is_valid() function.

    If you don't want to use bootloader to program the chip for the first time, you can manually write 0x01 to that address using nrfjprog.

  • I attached the screen shot with the error i am facing, please give your valuable suggestion to overcome this.

  • @Balaji:

    • Note that the bootloader was made for the Development kit, so you need to modify the button GPIO pin to match with the button on the PCA10001.
    • From the error in your screenshot, I suspect that the firmware on the dongle was not up to date. Please install the newest Master Control Panel with APIs (v3.5) and flash the PCA10000 dongle with MEFW_nRF51822_0.8.0_firmware.hex file.

    If the issue remains, please upload your bootloader and the application code you use.

Related