k_msgq_get() function return -35

Hello,

I run a piece of code on NCS1.8.0 on nRF5340-DK, and it returns -35 when executing k_msgq_get(),but the same code runs on NCS1.5.0 and the k_msgq_get() function works normally.

I checked -35 error code should be " No message of the desired type".

Are there any aspects that need special attention when porting the code of NCS1.5.0 to NCS1.8.0?

From debugging, I know that this function returns an error, but I can't find out why this error occurs. 

  • Hello Devin,

    Are there any aspects that need special attention when porting the code of NCS1.5.0 to NCS1.8.0?

    that is a little bit hard to say out of the box, unfortunately.

    I checked -35 error code should be " No message of the desired type".

    -ENOMSG means “Returned without waiting” in this particular case. You are not possibly calling k_msgq_get() from an ISR? Additionally, it can happen due to k_msgq_purge().

    Which timeout value are you using?

    Regards,

    Markus

  • Hello Markus,

    I am calling the k_msgq_get () function in a thread but not in the ISR, and the timeout parameter uses K_FOREVER.

    Best regards,
    Devin

  • Update:

    After careful inspection, it was found that the k_msgq_get() function was called in the interrupt handling function of i2s (using nrfx_i2s), and the timeout parameter was set to K_NO_WAIT, which should finally be the error reported at this location -35.

    The previous information is wrong, in the actual thread The k_msgq_get() function called is normal. Sorry for misleading you.

    BR,
    Devin

  • Devin Li said:

    After careful inspection, it was found that the k_msgq_get() function was called in the interrupt handling function of i2s (using nrfx_i2s), and the timeout parameter was set to K_NO_WAIT, which should finally be the error reported at this location -35.

    The previous information is wrong, in the actual thread The k_msgq_get() function called is normal. Sorry for misleading you.

    Thanks a lot for your feedback, Devin! I’m not quite sure how this is supposed to work in ISR’s, but I assume if -ENOMSG will be returned no message will be picked from the message queue?

    Regards,

    Markus

  • Hi Markus,

    I compared and debugged the same code on NCS1.5.0 and NCS1.8.0, and found some differences in workqueue. As shown in the following two screenshots:

    On NCS 1.8.0 there was a workqueue that was not executed (name not shown) due to -35 error and the priority of ipm_work_q is also different.

    I'm not sure if the code is not working properly because of workqueue differences, I'm not very familiar with zephyr, and I'm still checking the documentation. 

    Do you have some comments on the workqueue difference between different NCS versions?

    Best regards,
    Devin

Related