cancel
Showing results for 
Search instead for 
Did you mean: 

Don't enable interrupts

Adam Hamilton
Associate III

I would like to know if there is a way to NOT enable interrupts during the initialization of the EXTI. See below for snippet

  /* EXTI interrupt init*/
  HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(EXTI0_IRQn);
 
  HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(EXTI3_IRQn);

I want to be able to control when I enable the IRQ but there doesn't seem to be any option to do this.

if I uncheck the Enabled option within the NVIC Configuration tab, it completely removes the setup and IRQ callback, which is not what I want.

Basically, I want something like

  /* EXTI interrupt init*/
  HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
  HAL_NVIC_DisableIRQ(EXTI0_IRQn);
 
  HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0);
  HAL_NVIC_DisableIRQ(EXTI3_IRQn);

I just don't see any way to accomplish this. I suppose in my current circumstance I could initialise before the MX_GPIO_Init() function, that way I can be certain that if the external interrupt fires, my code will be ready for it.

However, there might be other situations where this won't be possible. In any case, if there is no way to accomplish something like the snippet above, can I request that for a future version of CubeMX for both standalone and IDE integration, the IRQ enablement is selectable via a checkbox

Sorry if this seems overly worded. Also, I would normally add this as a feature request but ST community seems to only do Q&A

Thanks

Adam

10 REPLIES 10
NPato
Associate II

Looks like they killed off IdeaZone but still no (obvious) solution to this request? 

It's a fairly important requirement to have control of when interrupts are enabled, I'm fine with it defaulting to enabling the interrupts but there should also be a way to override this. This is a serious problem, that can cause nasty problems with systems not booting in odd scenarios. It's made worse because the HAL needs global interrupts enabled as some of the initialisation functions (USB for example) use HAL_Delay that relies on the tick interrupt.

I'll probably work around this by disabling the EXTI in the NVIC config and then manually adding the interrupt vectors in user code and then enabling the EXTI interrupt when user code is ready. 

Cheers

Nigel