cancel
Showing results for 
Search instead for 
Did you mean: 

How to differentiate interrupts by rising or falling edge in STM32WB15?

Wiliam
Associate II

Dears, good afternoon.

We had standard hardware for telemetry using STM32G071. We decided to migrate it to STM32WB15CC in order to take advantage of BLE features.

It turns out that two sensors use the same interrupt line, PA8 and PB8, although one detects the rising edge and the other the falling edge. This is how we differentiate them in the STM32G071.

To differentiate the rising and falling edges in the STM32G071, we use the EXTI_FPR1 and EXTI_RPR1 registers. However, we did not find similar ones in the STM32WB15CC, but only an EXTI_PR1 register that identifies that an edge has occurred. Obviously, it is more difficult to change "almost" standard hardware, due to issues of size, layout, etc. We would like to resolve this issue through software.

Do you have any suggestions to resolve this problem?

The list of interrupts for GPIOs is below.

Thank you in advance for your attention!

William Ferreira (from Brazil)

 

Wiliam_0-1714596171974.png

Image 1: WB15 reference manual

Wiliam_1-1714596257253.png

Image 2: STM32G0xx reference manual

 

1 REPLY 1
Karl Yamashita
Lead III

Initialize 2 last_state_n variable for each interrupt, one variable would be low and the other variable will be high.

 

When you get an interrupt, read each pin and then compare to the last_state. If it's different, you save the current pin state into the last_state and set a flag to indicate you have an interrupt from x sensor.

 

In you main loop you check for the 2 flags. If either flag is set, you clear the flag and then you can see the value of the last_state to see if it's the falling/rising edge you're looking for.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.