Thread prioritization in nRF Connect SDK

Hi,

I am facing a peculiar problem, wherein my application has two threads as in below:

  1. Thread-1: is a preemptive thread which has UART functionality, along with UART hardware DMA and has priority 14
  2. Thread-2: I believe is MPSL thread, which is running my custom BLE-mesh model (I believe MPSL thread handles mesh models) and MPSL is of negative priority (Co-Operative).

  • When I enable both of these threads in my application, I see that OPCODEs i fire to my mesh models are not being handled in the code. I am not getting any prints I added in OPCODE callbacks. Whereas I am getting the prints within while loop of Thread-1 (UART functionality thread) frequently.
  • When I disable (comment out) Thread-1,  I see that OPCODEs i fire to my mesh models are being handled in the code and  I am getting any prints I added in OPCODE callbacks.

I do not understand how a co-operative higher priority thread (Thread-2 MPSL, BLE-Mesh models) is being starved by a lower priority thread (Thread-1 UART).

Is UART the issue here..? Or UART interrupts or UART hardware DMA which is starving thread-2..?

Thanks,

Ubaid

Parents
  • Hello Muhammed, sorry about the wait

    That sounds odd.

    When I disable (comment out) Thread-1,  I see that OPCODEs i fire to my mesh models are being handled in the code and  I am getting any prints I added in OPCODE callbacks.

    Could you check if switching which one you comment out also results in the opposite, as well as switching the priority of the two?

    Are the threads interacting in any particular way that could halt any of them?

    Regards,

    Elfving

Reply
  • Hello Muhammed, sorry about the wait

    That sounds odd.

    When I disable (comment out) Thread-1,  I see that OPCODEs i fire to my mesh models are being handled in the code and  I am getting any prints I added in OPCODE callbacks.

    Could you check if switching which one you comment out also results in the opposite, as well as switching the priority of the two?

    Are the threads interacting in any particular way that could halt any of them?

    Regards,

    Elfving

Children
No Data
Related