Mesh Serial example don't store sequence number

In the mesh serial example, I found that the sequence number isn't stored into persistent flash. If that is the case, if the board is power cycled, no one can communicate with it. Why it is implemented this way?

Parents Reply Children
  • Hello Summer, 

    For me, it works in mesh SDK v2.2.0 and also the later version.

    The SEQ won't be stored in the flash directly. Since the SEQ will keep increase whenever a node sends a mesh packet, it will cost lots of time for keeping storing SEQ into flash if a node sending mesh messages very frequently. So mesh SDK will arrange a "block" of SEQ in the flash, and will only update the block number when current SEQ is going to exceed the current block number, or when the device reset,

    The block size is defined in NETWORK_SEQNUM_FLASH_BLOCK_SIZE, the default setting value is 8192, which means:

    1. When a node is provisioned, it will send message with SEQ from 0, but will set a block with 8192 in the flash.

    2. If the node reset, the mesh stack will arrange a new block, so the SEQ will start from 8192, and if the node got reset again, the SEQ will start from  16384

    3. If the node keeps sending messages, which makes the SEQ exceed the arranged block size, then mesh stack will arrange a new block size.

    4. With the above mechanism, the mesh stack doesn't need to record every SEQ into the flash.

    Hope upon information can do help.