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

Help needed to perform BLE DFU using another BLE as central

Hello,

I need some help or advice on the easiest way to perform DFU in a nRF52832 device using a nRF52820 as a central through BLE.

My nRF52832 device already has the DFU working, as I can perform updates using nrfConnect (android and/or PC). Now I need to be able to use the other board, containing a nRF52820 device, as a gateway to perform the update. 

Seen lots of threads on the forum, but seems that it has never been made available by Nordic.

Also found some samples using the UART port to perform DFU, but it isn't an option in my case.

The approach shown here would be ideal. Is that feasable? What should I do?

I accept any suggestion, as long as the solution is a nRF52820 (connected to a PC via USB)  performing BLE DFU in a nRF52832 device.

Thanks in advance.

Parents
  • Hi

    I accept any suggestion, as long as the solution is a nRF52820 (connected to a PC via USB)

    It is possible to use MCUBoot with BLE and update it from a Linux or MacOS computer. See the SMP Server Sample. Will this work for you?

    Eventually, we have a SMP Client sample, which could run on the nRF52820 device.
    In this case you will have to upload the files to the Client from the computer first. SMP Protocol Specification and File management might give some hints to this.

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd. 

    I don't know MCUBoot. Isn't that windows compatible? As I understood, this would require using Zephyr, am I right? My whole application is bare metal, developed using IAR.

    Most likely I am going to develop my own bootloader, using the NUS service to transfer data and program the application area.

  • Hi

    Just to avoid confusion going forward:
    Are you using the nRF5 SDK or the nRF Connect SDK?

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd,

    Sorry, forgot to mention. I am using nRF5 SDK v17.10 and IAR 9 on windows11.

    Best Regards,

  • Hi,

    The easiest way to perform DFU from a PC is to use nRF Util together with a nRF52840 dongle. With the nRF52820 you are looking custom solution to handle reception and forwarding of the init command and FW image to your target. Documentation for the BLE DFU protocol can be found in the SDK documentation here: BLE.

    Best regards,

    Vidar

  • As my trial to build my own bootloader, without DFU, I did as follows:

    - Reserved for bootloader the area 0x26000 ~ 0x47fff. Set intvec_address as 0x26000;

    - Reserved for application the area 0x48000 ~ 0x7ffff . Set intvec_address as 0x48000;

    If bootloader detects a valid application (by reading a flag stored in flash address 0x7c000), it performs a jump to the application area. The code is as:

    if(validFw) {
          /* Jump to user application */
          JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS);
          JumpToApplication = (pFunction) JumpAddress;
          /* Initialize user application's Stack Pointer */
          __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); /* APPLICATION_ADDRESS = 0x48000 */
          //nrf_sdh_enable_request();
          //sd_softdevice_vector_table_base_set(APPLICATION_ADDRESS);
          JumpToApplication();
        }
     

    But something goes wrong and it just restarts to bootloader. I tried setting the interrupt vector address for softdevice (sd_softdevice_vector_table_base_set(APPLICATION_ADDRESS)) but it didn't work either.

    Any idea of what am I doing wrong?

Reply
  • As my trial to build my own bootloader, without DFU, I did as follows:

    - Reserved for bootloader the area 0x26000 ~ 0x47fff. Set intvec_address as 0x26000;

    - Reserved for application the area 0x48000 ~ 0x7ffff . Set intvec_address as 0x48000;

    If bootloader detects a valid application (by reading a flag stored in flash address 0x7c000), it performs a jump to the application area. The code is as:

    if(validFw) {
          /* Jump to user application */
          JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS);
          JumpToApplication = (pFunction) JumpAddress;
          /* Initialize user application's Stack Pointer */
          __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS); /* APPLICATION_ADDRESS = 0x48000 */
          //nrf_sdh_enable_request();
          //sd_softdevice_vector_table_base_set(APPLICATION_ADDRESS);
          JumpToApplication();
        }
     

    But something goes wrong and it just restarts to bootloader. I tried setting the interrupt vector address for softdevice (sd_softdevice_vector_table_base_set(APPLICATION_ADDRESS)) but it didn't work either.

    Any idea of what am I doing wrong?

Children
  • It looks like you are retrieving the SP and Reset vector from the same address. The initial stack pointer value is stored at the intvec_address while the reset handler is at intvec_address+0x4.

    You must also call sd_softdevice_vector_table_base_set() to make the softdevice forward interrupts to your application.

Related