2020-06-17 06:03 AM
Hello,
I would like to know, whether it is possible to configure GPIO pins of STM32F4 MCU family to be interrupted by a pulse signal which has a rising edge and after 100ms followed by a falling edge, like in the screenshot attached. (something like high to low transition)
Is it possible for GPIO pins to be interrupted by the occurrence of both edges?
If so, how can be coded - any idea ?
I thank you for your time,
Loni
2020-06-17 06:18 AM
No, you can't have it interrupt on a pulse. Only rising and/or falling edges. You could use the timer to measure the pulse width and then do something based on that, but it'll take CPU resources at every edge.
2020-06-17 08:12 AM
Thank you for your answer.
Best Regards,
Loni
2020-06-17 08:39 AM
You could use the exti interrupt and change the edge polarity in the isr.
2020-06-17 08:47 AM
Hello,
Thank you for your reply. Do you have any code of this ?
I am new in this community and lack some experience.
Could you tell me how to change the polarity inside the ISR, please.
Loni
2020-06-17 09:00 AM
Sorry no. From memory in my dealings with the F7, you need to set a sysconfig register and bits in the exti registers for the interrupt mask and edge polarity. You can change the edge polarity in the isr. RTM.
2020-06-17 12:47 PM
Hello RMcCa
Thank you for your reply.
I have configured the interrupt using SYSCFG and EXTI for unmasking and selecting the trigger edge.
However, within ISR code, I am not sure what kind of code structure could do it.
Maybe:
A rising edge could trigger the ISR,
Then inside the ISR, the falling edge could be set and its status of occurrence has to be monitored with an IF-statement.
When the condition is met, the the rest of the code can start to execute...
Do you think will be valid ?
I thank you for your time,
Loni
2020-06-20 12:34 AM
You can use a timer in one pulse combined reset and trigger mode. Set external trigger to rising edge, input capture on falling edge and connect the pins together externally. Enable the input capture interrupt and check the captured value, which will represent the length of pulse. You can even filter out too long pulses with hardware by setting timer period to some 120 ms, for example.