I have used pstorage before but when I add scheduler to my project I face an error in update function of pstorage that in debug I found error_code : NRF_ERROR_NO_MEM . any idea of what happened??
I have used pstorage before but when I add scheduler to my project I face an error in update function of pstorage that in debug I found error_code : NRF_ERROR_NO_MEM . any idea of what happened??
Have you made sure you added app_sched_execute() in the main loop ? pstorage_update() return NRF_ERROR_NO_MEM if the pstorage buffer is full. Could you check pstorage_sys_event_handler is called inside sys_evt_dispatch() ?
Could you check what is the value of PSTORAGE_CMD_QUEUE_SIZE in pstorage_platform ?
Have you made sure you added app_sched_execute() in the main loop ? pstorage_update() return NRF_ERROR_NO_MEM if the pstorage buffer is full. Could you check pstorage_sys_event_handler is called inside sys_evt_dispatch() ?
Could you check what is the value of PSTORAGE_CMD_QUEUE_SIZE in pstorage_platform ?
Hi Hung yes, app_sched_execute() is in main loop. pstorage_sys_event_handler() not called when error occurred but when I comment pstorage functions from my project code works correctly without any error. The value of PSTORAGE_CMD_QUEUE_SIZE is 10.
I think you need to step into the code to check why it return NO_MEM, where exactly the code returned. Do you have that on the first time you call pstorage_update() or it's after a while ?
In first call that I call pstorage_update() error occurs but for example pstorage_load() not causes an error !! How do I find where code returned?
If it happens every time you call pstorage_update() then you just need to put a breakpoint there and then step into the code. If you don't know when it happens, you can try adding UART log inside the codefor example.
Most likely the error was thrown from cmd_queue_enqueue(). We need to findout why the queue was full.