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
  • Hello,

    I see what you mean. I have forwarded this to our ZigBee team to see whether it actually is a bug, but I agree that it says it requires 32kB of flash from the "Typical flash and RAM requirements table" and 48kB from the "Zigbee stack flash and RAM layout". I assume this is 32kB + a config page or a swap page.

    They replied that they will look into this, but that they can't guarantee to have an answer until next week. I am sorry for the delay. I will get back to you as soon as I hear from them.

    However, 48kB of persistant storage (FDS pages) would suggest 0x0C = 12 pages, so if you'd like, you can try with this, and see whether you run into some unexpected issues that you can't reproduce with 0x30 = 48 reserved pages.

    Best regards,

    Edvin

  • Thanks, no hurry. Just found it curious that so much flash should be reserved, so I thought I'd ask.

  • It is a good catch, and a valid question Slight smile

    -

    Edvin

  • 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

Reply
  • 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

Children
Related