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

Does Zigbee persistent data need 48kB or 48 pages of flash?

Looking at the instructions to add Zigbee to a SDK example here, I am instructed to define FDS_VIRTUAL_PAGES_RESERVED to 0x30 to reserve some flash for Zigbee persistent data. It seems like the same number is used in the multiprotocol examples as well (for instance #define FDS_VIRTUAL_PAGES_RESERVED ((ZIGBEE_NVRAM_PAGE_SIZE * (ZIGBEE_NVRAM_PAGE_COUNT + ZIGBEE_NVRAM_CONFIG_PAGE_COUNT))/FDS_VIRTUAL_PAGE_SIZE) ).


This seems to reserve 48 pages of flash. The documentation here however indicates that one needs to reserve 48kB of flash, not 48 pages (192kB).

If I define FDS_VIRTUAL_PAGES_RESERVED to 0x30 as instructed, flash_end_addr() in fds.c (from the Thread and Zigbee SDK, v2.0.0) returns 0xD0000, seen by "printf-debugging". Examining the flash after running and joining a network, shows unused flash from 0xD0000 to 0xF4000, and some used flash after 0xF4000. This is without any bootloader.

Have I misread or miscalculated the macros, or is there something odd here? How much flash should really be reserved for the Zigbee persistent data? I could use those extra 144kB that would be freed if 48kB is the answer :)

Parents Reply Children
  • Hello,

    I just received an answer from our ZigBee team, and they confirm your suspicion:

    From the second link, if it is correct that you need the space from 0x000F4000 to 0x00100000, which is 48kB. 48kB is 12 FDS pages. From sdk_config:

    // <o> FDS_VIRTUAL_PAGE_SIZE  - The size of a virtual flash page.

     __ 

    // <i> Expressed in number of 4-byte words.

    // <i> By default, a virtual page is the same size as a physical page.

    // <i> The size of a virtual page must be a multiple of the size of a physical page.

    // <1024=> 1024

    // <2048=> 2048

     __ 

    #ifndef FDS_VIRTUAL_PAGE_SIZE

    #define FDS_VIRTUAL_PAGE_SIZE 1024

    #endif

    So the number of pages should be set to 12, which makes up 48kB, which is what the persistent storage needs. 

    Thank you for your input!

    Best regards,

    Edvin

Related