MPSL thread being blocked due to application threads

Hi,

With reference to the below image:

As you can see I have 2 UART threads running on priorities 14, at baud 115200, which are I believe blocking the MPSL signal thread, due to which my BLE Mesh models are responding to OPCODES with a delay of 9 mins & at time getting stuck without progressing. Further I also observed BT APIs reaching maximum retries.

I need your help with 2 things:

1. How can I get this to work whilst retaining my application & UART threads..?

2. How can I probe the CPU utilization further to find out what is happening or what is the issue leading to MPSL thread being blocked..?

Thanks,

Ubaid

Parents
  • Hi,

    Looking at the documentation here, I don't really see how your application threads are causing issues:

    The scheduler distinguishes between two classes of threads, based on each thread’s priority.

    • A cooperative thread has a negative priority value. Once it becomes the current thread, a cooperative thread remains the current thread until it performs an action that makes it unready.

    • A preemptible thread has a non-negative priority value. Once it becomes the current thread, a preemptible thread may be supplanted at any time if a cooperative thread, or a preemptible thread of higher or equal priority, becomes ready.

    2. How can I probe the CPU utilization further to find out what is happening or what is the issue leading to MPSL thread being blocked..?

    You can try to use the CPU load measurement module: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/nrf/libraries/debug/cpu_load.html

    It's expected that these MPSL threads are 'blocked' most of the time, they are waiting for semaphore in the mpsl irq handler. https://github.com/nrfconnect/sdk-nrf/blob/v1.9.2/subsys/mpsl/init/mpsl_init.c#L53

    Q: Does your application work as expected when you don't have these UART threads? If yes, could you post how these threads looks like ?

  • Hello ,


    You can try to use the CPU load measurement

    1. Can you please suggest any tool or add on that gives me thread wise details on CPU occupancy..?
    Any live monitoring would help.


    I don't really see how your application threads are causing issues

    This is what I felt as well, But as soon as I comment out the two UART threads & one application threads, my mesh models behave completely fine and response to OPCODES is instantaneous.

    Does your application work as expected when you don't have these UART threads?

    Yes, as soon as I comment out the two UART threads & one application threads, my mesh models behave completely fine.
    2. I also observed that by reducing UART baud rate from 115200 to 9600, there was some improvement. Hence I suspect any interrupts are occupying the CPU or any dependent resource like semaphore is unavailable to MPSL thread...?

    could you post how these threads looks like ?

    Will get back on this.

    Thanks,

Reply
  • Hello ,


    You can try to use the CPU load measurement

    1. Can you please suggest any tool or add on that gives me thread wise details on CPU occupancy..?
    Any live monitoring would help.


    I don't really see how your application threads are causing issues

    This is what I felt as well, But as soon as I comment out the two UART threads & one application threads, my mesh models behave completely fine and response to OPCODES is instantaneous.

    Does your application work as expected when you don't have these UART threads?

    Yes, as soon as I comment out the two UART threads & one application threads, my mesh models behave completely fine.
    2. I also observed that by reducing UART baud rate from 115200 to 9600, there was some improvement. Hence I suspect any interrupts are occupying the CPU or any dependent resource like semaphore is unavailable to MPSL thread...?

    could you post how these threads looks like ?

    Will get back on this.

    Thanks,

Children
Related