Skip to main content
Rajeev Arora
Senior
November 19, 2020
Solved

TickPriority not assigned to uwTickPrio

  • November 19, 2020
  • 3 replies
  • 2301 views

Hello,

Issue 1: assert_failed() triggered

I had observed an issue wherein the file stm32h7xx_hal_timebase_tim.c generated by STM32CubeMX for STM32H753BIT6 has

HAL_InitTick()

implementation different from what is provided on the GitHub repository of STM32CubeH7 (One may refer to file stm32h7xx_hal_timebase_tim_template.c to check a sample implementation).

I am concerned that the STM32CubeMX generated code calls only below inside HAL_InitTick():

/*Configure the TIM2 IRQ priority */
 HAL_NVIC_SetPriority(TIM2_IRQn, TickPriority, 0);
 
 /* Enable the TIM2 global Interrupt */
 HAL_NVIC_EnableIRQ(TIM2_IRQn);
 
 /* Enable TIM2 clock */
 __HAL_RCC_TIM2_CLK_ENABLE();

(where TIM2 is the timer being used by FreeRTOS).

I believe the code should be modified to:

/*Configure the TIM2 IRQ priority */
 if (TickPriority < (1UL << __NVIC_PRIO_BITS))
 {
 HAL_NVIC_SetPriority(TIM2_IRQn, TickPriority ,0U);
 
 /* Enable the TIM2 global Interrupt */
 HAL_NVIC_EnableIRQ(TIM2_IRQn);
 uwTickPrio = TickPriority;
 
 /* Enable TIM2 clock */
 __HAL_RCC_TIM2_CLK_ENABLE();
 }
 else
 {
 return HAL_ERROR;
 }

Please check the line number 8 above (i.e. uwTickPrio = TickPriority;) which is crucial for the code to execute and not result in a call to assert_failed() when macro USE_FULL_ASSERT is defined.

Please share your views.

I have had discussion with STM32CubeH7 team about above (via raising issue number 71 on the respective GitHub issues link). The team has asked me to connect with STM32CubeMX team and share my observations.

Issue 2: value assigned to macro TICK_INT_PRIORITY

Assuming the Issue 1 is not fixed, and the coder assigns

uwTickPrio = TICK_INT_PRIORITY;

before making a call to

SystemClock_Config()

The coder then calls below function inside the FreeRTOS timer interrupt

osMessageQueueGet()

Where, osMessageQueueGet() is wrapper around

xQueueReceiveFromISR()

The observed issue is that as TICK_INT_PRIORITY = 0, the ASSERT / config ASSERT

configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
 
is triggered inside function vPortValidateInterruptPriority()

Please suggest what should be the value for macro TICK_INT_PRIORITY or whether above line 1 needs a fix.

Thanks,

Rajeev

This topic has been closed for replies.
Best answer by Khouloud ZEMMELI

Hello @Rajeev Arora​ ,

About your Issue 1 , the point is internally raised to add the missed line of code.

We are deeply sorry for any inconvenience this may have caused..

Best Regards,

Khouloud

3 replies

Rajeev Arora
Senior
November 19, 2020
Rajeev Arora
Senior
November 24, 2020

Hello @Khouloud ZEMMELI​  ,

Is there a solution for my above concern, I am unable to continue development because of reported issue.

Please help.

Thanks,

Rajeev

Khouloud ZEMMELI
Khouloud ZEMMELIBest answer
ST Employee
November 24, 2020

Hello @Rajeev Arora​ ,

About your Issue 1 , the point is internally raised to add the missed line of code.

We are deeply sorry for any inconvenience this may have caused..

Best Regards,

Khouloud

Rajeev Arora
Senior
November 24, 2020

Hello @Khouloud ZEMMELI​ ,

Thanks for the update.

May someone look at the concern with xQueueReceiveFromISR(). With uwTickPrio = TICK_INT_PRIORITY and STM32CubeMX assigning value ZERO to macro TICK_INT_PRIORITY, an ASSERT is being triggered, when xQueueReceiveFromISR() / osMessageQueueGet() is called inside the TIMER 2 Timer Interrupt with Timer 2 being used as the FreeRTOS timer.

Please refer to the code line

configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );

inside function vPortValidateInterruptPriority().

Thanks,

Rajeev

Rajeev Arora
Senior
January 4, 2021

Hello @Khouloud ZEMMELI​  ,

Is it possible that the STM32CubeMX provides a way to set macro `1 <= TICK_INT_PRIORITY <= 15`?

Above request if implemented should help fix the `issue 2`.

Thanks,

Rajeev