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

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

  • what do you mean to use bootloader to upload for first time? is there a bootloader exe?

Reply Children
No Data
Related