cancel
Showing results for 
Search instead for 
Did you mean: 

For interrupt priorities set using the STM32IDE CubeMX, where are the auto-code generated HAL_NVIC_SetPriority() calls located?

NFern.1
Associate III

I could locate the HAL_NVIC_SetPriority() calls for DMA and EXT1 Interrupts in main.c as shown below.

I could not find the  HAL_NVIC_SetPriority() calls for RTC, USART & Timers - TIM4, TIM5, TIM6, TIM7. Where is the interrupt priority for these peripherals set in the code by CubeMX?

The CubeMX configuration is as follows :

0693W00000Kb9w3QAB.pngHAL_NVIC_SetPriority() calls found in main.c

static void MX_DMA_Init(void)
{
......
  /* DMA interrupt init */
  /* DMA1_Channel4_IRQn interrupt configuration */
  HAL_NVIC_SetPriority(DMA1_Channel4_IRQn, 6, 0);
  HAL_NVIC_EnableIRQ(DMA1_Channel4_IRQn);
  /* DMA1_Channel7_IRQn interrupt configuration */
  HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 4, 0);
  HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
}
 
static void MX_GPIO_Init(void)
{
.....
  /* EXTI interrupt init*/
  HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
}

I am using :

STM32CubeMX 6.2.1.202103241236

STM32CubeIDE Version: 1.6.1 Build: 9958_20210326_1446 (UTC)

Processor is STM32F105RC with STM32Cube_FW_F1_V1.8.4

2 REPLIES 2
TDK
Guru

You can use Search -> File... to find all instances of HAL_NVIC_SetPriority to see if/where they exist.

It's possible they aren't set up at all if the peripheral isn't enabled.

If you feel a post has answered your question, please click "Accept as Solution".
NFern.1
Associate III

Thanks, the HAL_NVIC_SetPriority() calls are added to the stm32f1xx_hal_msp.c file in the HAL_<Peripheral>_MspInit() functions

0693W00000KbDrMQAV.png