Swapping the order of the __WFI() and the __enable_irq() should work.
View all questions in Cortex-M / M-Profile forum