cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L External interrupt PortB and PortD with rising/falling configuration

davide239955_st
Associate II

Hello everybody,

In my project which uses STM8L151G6 MCU, I need 6 interrupt inputs on both rising/falling edge. In particular those pins are PB0, PB1, PB2, PD1, PD2, PD3.

Please note I'm using "port interrupt mode", i.e. EXTIB_G_IRQHandler and EXTID_H_IRQHandler are used.

If all pins of the port (for example PB) are "floating" (internally pulled-up), then the first one which falls, it triggers EXTIB_G_IRQHandler interrupt as expected and everything it works.

But, if 1 pin among PB0, PB1 and PB2 is already low, then interrupt is not triggered by the other pins even if EXTI->SR2 register has been "cleared" inside the interrupt handler.

I have reduced the project to a very simple test code in order to reproduce the issue. Please find attached the project folder so you may test.

TEST procedure:

-set breakpoints in EXTIB_G_IRQHandler, EXTID_H_IRQHandler and EXTI0_IRQHandler...EXTI7_IRQHandler

-start debug

-leave PB0,PB1,PB2 "open" and connect one of them to GND -> interrupt EXTIB_G_IRQHandler is triggered

-open the pin and test another one -> interrupt is triggered

Now...

-connect one pin to GND (e.g. PB0) and leave it connected to GND

-test another pin (e.g. PB1) -> interrupt is not triggered anymore until PB0 is released

-same procedure apply to PD1,PD2,PD3 group of pins.

What am I wrong? Is the EXTI invalid configuration?

Thanks

4 REPLIES 4
Cristian Gyorgy
Senior III

Hi!

What you experience is normal. If you use only one interrupt (EXTIB_G) for the 3 PB pins, all 3 pins are and-wired to the interrupt controller input, so if one of the 3 pins is low, a change of state for the other pins will not trigger an interrupt, see manual RM0031.

If you need 6 external interrupts, you should use the EXTI0..7 with a different pins usage, or a combinations of interrupts.

AA1
Senior III

Hi,

I have already detected this problem. Tell me the RM0031 page where says that all pins are and-wired?

And STM8S family don't have this behavior.

RM0031 external interrupt section needs to be improved.

davide239955_st
Associate II
AA1
Senior III

It is in GPIO section. And STM8S RM0016 page106 have same schematic and have different behavior. On STM8S interrupts on same port works independently.

As I said RM0031 external interrupt section needs to be improved. Also manual needs a revision. For example external interrupt section have bad formatted text.