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

Loading data into Application Data block during programming

The device I am building requires a quantity of data to be loaded into the application data block so that it can be accessed at run time.  The data is effectively calibration data and may change with each unit.  I therefore don't want to hard-code it into the application itself.

I am using Keil and nRFgo studio.  I see how to program bootloader, softdevice and application, but no way to program the application data block.

Is this possible?  How would I go about it?

Many thanks

Barney

  • Hi Barney,

    You have several options to code data into the flash during production. You can for example write the data using "nrfjprog --memwr". The only thing you need to make sure is that the flash page you write to is free. So no other hex files should be programmed there, and it should not be used for other flash storage (such as FDS which is for instance used by the Peer manager to store BLE bonding information). If you use a bootloader you need to set DFU_APP_DATA_RESERVED in nrf_dfu_types.h accordingly, so that the bootloader does not overwrite your data during a DFU upgrade.

  • hello.  Thank you for your reply.   I need to program quite a large block of data, about 4kb, into the application data block of the flash memory.  "nrfjprog --memwr" programs one byte at a time as far as I can tell.  Is there a way to program a whole binary file into flash memory?  Thank you.

  • Hi,

    If you have a binary file then you might want to use J-Link Commander instead, as that will let you take a binary blob and specify which address you want to write it to using the "loadbin" command. I am sure there are other tools from other vendors as well, but at least that is one way to do it. (Remember that you still need to reserve the flash space so that it is not overwritten by either the bootloader during DFU or FDS as described in my previous post.)

Related