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

nrf52832 buttonless DFU with fstorage

I am using nrf52832 with buttonless DFU ,SDK 15.0,using fstorage.I want to store some device information in flash,such as serial number,hardware version,these data will not be erased duing DFU,and I want to save firmware version too,I tested that if I comment device read and write ,the DFU works well,if I uncomment device read and write,and rease 4to1 hex to device,it will not run to app and stuck in bootloader and broadcast.

this is my configuration:

Bootloader:start addr:0x78000,size:0x6000 ,end addr:0x7e000

APP:start addr:0x26000,size:0x5a000,end addr:0x80000

fstorage setting:

NRF_FSTORAGE_DEF(nrf_fstorage_t fstorage) =
{
/* Set a handler for fstorage events. */
.evt_handler = fstorage_evt_handler,
.start_addr = 0x73000,
.end_addr = 0x78000,
};

/*device information addr define*/

uint32_t Hardware_VerAddr           __attribute__ ((at(0x74400)));
uint32_t Serial_NumAddr               __attribute__ ((at(0x74300)));
uint32_t SN_HW_EXIST_Addr      __attribute__ ((at(0x74100)));
uint32_t Firmware_VerAddr           __attribute__ ((at(0x73FD0)));
uint32_t Firmware_EXIST_Addr    __attribute__ ((at(0x73FC0)));

I want to write hardware version and serial num in Reserved Application Data area,and write firmware version in the end of app.below 0x75000.

it covered Application Data area,I tried to change fstorage`s start_addr from 0x73000~0x75000, if I comment device read and write ,the DFU works well,if I uncomment device read and write,and rease 4to1 hex to device,it will not run to app and stuck in bootloader and broadcast.

Is there any configuration wrong?

 

Parents
  • new progress:

    I regenerate public key and privete key,DFU and device information work well ,but when i change the Firmware_Version,and run dfu, the reported frimware is still old one ,not new one.

    I guess this is because the DFU uses dual bank ,the Firmware_VerAddr is not erased during OTA,so it remain the same,So how to set the edge address of bank0 and bank1,to make the code of Firmware_Version work as I wash?

  • Hi,

    The DFU image will become too big if variables are placed inside the preserved app data region at link time. You may check the size difference by comparing the size of the *.bin file inside the generated DFU package with and without these device information variables included.

    Also, you may want to consider using the UICR registers for one-time configurations such as the serial number and device type. And the app FW version is already stored in the bootloader settings page (s_dfu_settings @0x7F000).

  • Thanks for response,

    with device information,the app.bin file`s size is 100KB,without device information ,the app.bin file`s size is 99kb, almost the same.

    My app.hex size is 279kb,is it too big for dual bank dfu,and it automaticly choose single bank and erase flash?

    the FW version is selfdifined,so we can read it and show..

Reply Children
No Data
Related