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

Bootloader for nRF51422 ?

Hello Everybody,

I need to write a boot loader for nRF51422. Any suggestion for it, reference site ,sample code for quick reference ?

thanks and regards Robin Singh

Parents
  • Hi Robin,

    have you looked at the bootloader example from the nRF51822 SDK? It cannot be used directly on the nRF51422 yet, but it might serve as a reference for you. It includes two ways of transferring the updated image, serial transfer (UART) and over-the-air (BLE).

    The nRF51422 SoftDevice is being updated to offer the same bootloader functionality as the nRF51822 one. Once that happens, the nRF51822 bootloader example will be directly applicable. When this update is released you might have to get a updated silicon revision of the nRF51422 though..

    Audun

Reply
  • Hi Robin,

    have you looked at the bootloader example from the nRF51822 SDK? It cannot be used directly on the nRF51422 yet, but it might serve as a reference for you. It includes two ways of transferring the updated image, serial transfer (UART) and over-the-air (BLE).

    The nRF51422 SoftDevice is being updated to offer the same bootloader functionality as the nRF51822 one. Once that happens, the nRF51822 bootloader example will be directly applicable. When this update is released you might have to get a updated silicon revision of the nRF51422 though..

    Audun

Children
  • "The nRF51422 SoftDevice is being updated to offer the same bootloader functionality as the nRF51822 one. Once that happens, the nRF51822 bootloader example will be directly applicable. When this update is released you might have to get a updated silicon revision of the nRF51422 though"

    So does it mean i can not write a uart based boot loader for nrf51422? until you guys update the soft device ?

  • You are free to write any bootloader you'd like. But without softdevice support there is a weak point when upgrading the first flash page of the application space (where the interrupt vectors are). If this flash page write fails (power loss for example) you risk getting in an unrecoverable error. When supported, the softdevice can be configured to forward interrupts to a bootloader residing anywhere in flash.

  • You are free to write any bootloader you'd like. But without softdevice support there is a weak point when upgrading the first flash page of the application space (where the interrupt vectors are). If this flash page write fails (power loss for example) you risk getting in an unrecoverable error. When supported, the softdevice can be configured to forward interrupts to a bootloader residing anywhere in flash.

  • Thanks for the reply Audun. i tried to write the bootloader program , but it seems to be i have problem in jumping to my application program. here is what i tried: step1: i took a example image hex in a header .[start address =0x30000 size 0x2800] const uint8_t hexFileArray2[2007] = { 0x3A, 0x30, 0x32, 0x30, 0x30, 0x30, 0x30, 0x30, .............}; step 2: i write this image in my main program to flash : sd_softdevice_enable(); ..... if (NRF_UICR->CLENR0 == 0xFFFFFFFF) { NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; NRF_UICR->CLENR0 = 0x30000; while (!NRF_NVMC->READY); NRF_NVMC->CONFIG = 0; NVIC_SystemReset(); } then : step 3: write image image_size = 2007; no_of_pages = (image_size / page_size) + 1; erase_no_of_pages(NRF_UICR->CLENR0, no_of_pages);

          data_packet_handle();//its just write the image start from 0x30000
      uint32_t  n_err_code = sd_softdevice_disable();
          APP_ERROR_CHECK(n_err_code);
    

    step 4: interrupts_disable(); step 5: now jump to application my_application_main_t application_main = (my_application_main_t )(0x30000+4); if (application_main != (my_application_main_t) 0xFFFFFFFF) { // Initialize user application's Stack Pointer __set_MSP((__IO uint32_t) 0x30000); application_main();//jump to application. but this does not jump to application program.

    Do i need to change any CPU mode(USER mode , SVC mode or etc ) setting to jump to application's vector table. because my program seems to be coming back to soft device vector table.?

Related