STM32 External Interrupt via GPIO cannot be triggered after waking up from STOP mode

I have a problem with a project based on an STM32L051. I want to use the stop mode and wake up on an external (GPIO based) IRQ. This all works great but after the MCU woke up once, no IRQs seem to work. I have a very simple IRQ handler which just outputs some debug info for now. Naturally I do hal-initialize again after I woke up. Also the whole thing works when I use stand-by mode instead of stop mode. I tried to enable the related IRQ via HAL_NVIC_EnableIRQ(EXTI0_1_IRQn); explicitly but it did not help. Any idea what could be missing?

• Is the GPIO clock still running in stop mode? – Jeroen3 Jan 20 '18 at 12:43
• I don't know but as the the wake-up works, I guess yes. – vanthome Jan 22 '18 at 14:50

For me, a simple HAL_NVIC_SystemReset(); did the trick.
  HAL_NVIC_SetPriority(IRQn, 1, 1);