0

I use

NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE; 
NVIC_Init(&NVIC_InitStructure);

to enable the interrupt and then use

NVIC_InitStructure.NVIC_IRQChannelCmd=DISABLE; 
NVIC_Init(&NVIC_InitStructure);

to disable it. So how can I re-enable the interrupt, use ICER,ISER or any other ways?

2 Answers2

2

To enable and disable interrupts in NVIC, just use the relevant CMSIS functions:

void NVIC_EnableIRQ(IRQn_Type IRQn);
void NVIC_DisableIRQ(IRQn_Type IRQn);
Tagli
  • 2,412
  • 2
  • 11
  • 14
1

There are CMSIS library functions to enable the interrupts and disable the interrupts.

using void NVIC_EnableIRQ(IRQn_Type IRQn); you can re enable the disabled interrupt.

you need to mention the IRQ number for your interrupt to enable it again.

However if you want to enable or disable all interrupts in one go, then you must use ARM functions in STM32. these are

__disable_irq();
__enable_irq();

By using these you can pretty mush enable disable all the interrupts on ARM core.

Dheeraj Kumar
  • 377
  • 2
  • 13