cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB scheduler and CubeMX: adding different priority levels for tasks using CubeMx

burn_
Associate III

Good day,

I'm using the scheduler to be able to run tasks on the STM32WB. It all works fine, but I would like to be able to add different priority levels to tasks, since the timing of some tasks are more critical than others.

I edited app_conf.h as follows (default only had CFG_SCH_PRIO_0 and CFG_PRIO_NBR):

/**
 * This is the list of priority required by the application
 * Each Id shall be in the range 0..31
 */
typedef enum
{
    CFG_SCH_PRIO_0,
    CFG_SCH_PRIO_1,
    CFG_SCH_PRIO_2,
    CFG_PRIO_NBR,
} CFG_SCH_Prio_Id_t;

I also edited utilities_conf.h as follows (was 2, now 4):

#define UTIL_SEQ_CONF_PRIO_NBR                  (4)

I'm happy to report that this works! However, I need to keep on changing these two files every time I regenerate code with CubeMx (I'm using it from within STM32CubeIDE). Is this perhaps something that could be added to a next revision of the STM32WB software package? Perhaps under the scheduler, the number of priority levels can be chosen.

3 REPLIES 3
Christophe Arnal
ST Employee

​Hello,

Your analysis is correct.

This issue will be reported to the developement team.

Regards.

burn_
Associate III

Thank you @Christophe Arnal​ ! I appreciate that.

Also the UTIL_SEQ_CONF_PRIO_NBR macro is redundant and unnecessary. It can be replaced by the CFG_PRIO_NBR constant, which will change it's value automatically.