I want a main routine that runs continually but can be interrupted. I am at a loss as to how to get the UART or ADC interrupt to work properly. They only behave as expected if my main loop has wait-for-interrupt (i.e. goes into low power mode). I understand that at reset the interrupt level in CCR is set to low and the level in the ITC_SPR registers is set to high, so main loop code should be interrupted. However if I run it without wfi I only get the first interrupt. If I call rim (enable interrupts) in the main code prior to the main loop, I get no interrupt, but this should force the main loop to low interrupt level. I'm very confused and obviously missing something because this seems like a normal operational mode that must work. Any ideas appreciated.
In modern stm8 (2022-2023) peripherls library interrupts are set by XXX_ITConfig(interrupt_flag, ENABLE/DISABLE);
After checking them in main loop you MUST clear the pending bit or clear a flag by XXX_ClearItPendingFlag(interrupt_type) or XXX_ClearFlag;
These libraries are well known and available. For every peripheral they set different registers so if you want exact bit settings just look into them separately. I assure they work properly and interrupts do fire.
If someone has issues -> check peripherls library and set registers properly.