Dangerous error causes fires and devastation!
Hi. I'm glad you're reading this, i hope you can help.
Click-bait aside, i experience a nasty and unexpected behavior of external interrupts in a professional, industrial product designed around STM8AL318ATC.
In short, there are 2 digital signals (from an encoder) input in PD2 and PD4 to which i want to react by triggering an IRQ on every edge.
Pseudo-code with setup (macros that expand to proper register settings, i promise):
EXTI_CONF1_PDHIS = 1u; // PD[7:4] used for EXTID IRQ
EXTI_CONF1_PDLIS = 1u; // PD[4:0] used for EXTID IRQ
// EN1_1 (encoder 0, signal A)
REG_CR1(EN1_1) = CR1_INP_FLOAT;
REG_DIR(EN1_1) = DDR_INP;
REG_EXTI_CR(EN1_1) = EXTI_CR_EDGE_RISING_AND_FALLING;
REG_CR2(EN1_1) = CR2_INP_IRQ;
// EN1_2 (encoder 0, signal B)
REG_CR1(EN1_2) = CR1_INP_FLOAT;
REG_DIR(EN1_2) = DDR_INP;
REG_EXTI_CR(EN1_2) = EXTI_CR_EDGE_RISING_AND_FALLING;
REG_CR2(EN1_2) = CR2_INP_IRQ;...and the ISR:
INSTALL_ISR(EXTID_vector, rotc_0_isr)
{// I got here due to an edge on either EN1_1, EN1_2, or both
/////////////////////////////////////////////////////////
DBG_HI(DBG0);
/////////////////////////////////////////////////////////
EXTI_SR2 = MASK_EXTI_SR2_PDF; // writing 1 clears flag
/////////////////////////////////////////////////////////
DBG_LO(DBG0);
/////////////////////////////////////////////////////////
}The following grab shows the 2 signals together with my debug output, while serving the interrupt.

I hope it's clear to anyone that the behavior of the external interrupt controller is not according to expectations (clearly far from interrupting on *every* edge)...
The questions are now:
- Am i doing something wrong/missed some settings?
- Is this a bug in the HW (known or unknown)?
- Is this, after all, the expected behavior, documented in a corner of the manual that i missed, rendering this uC totally useless from my application?
Thanks in advance for your help!
Arthur
