Hi,
I have a mesh device (door sensor) with cell battery powered.
When triggered, the device power on, do mesh stack init and start mesh stack, publish a mesh message, and then system off in seconds.
The issue is that access_model_publish() always return NRF_ERROR_FORBIDDEN if call this funtion immediately after mesh_stack_start(), the error was caused by net_state_seqnum_alloc():590 in net_state.c. If move access_model_publish() into a timer with at least 15ms delay, it works.
After some investigation, i found m_net_state.seqnum_max_available was set to current seqnum when boot up, then increase a number (default is 8192) to generate new available seqnum and write to next seqnum block in flash. Until flash write complete, m_net_state.seqnum_max_available will change to the new value. the time of flash write is the root cause of this issue.
In spec, the max time to write one word is 338us, erase one page is 2.05~89.7ms. so i think 100ms delay is enough.
Please correct me if there's any mistake. Thanks.
Best regards,
Pendy