Hi
I would like to understand how to properly use a gpio of an stm32 and configure it as an interrupt pin. From flowocode I saw that it is possible to set the pin both up and down.
My goal is to activate a macro every time the pc3 pin changes state. As you can see from the circuit, the pin is connected to the output of a comparator. Whenever the value in IN_A changes, the comparator output will be high or low.
Also, how can I calculate the interrupt rate?
Kind Regards
STM32f303 interrupt
-
- Posts: 89
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 10:06 am
- Location: Italy
- Has thanked: 37 times
- Been thanked: 10 times
-
- Valued Contributor
- Posts: 447
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 81 times
- Been thanked: 243 times
Re: STM32f303 interrupt
It looks like you have most of it already in place there.
The macro "TIMER" will get called whenever PC3 state changes from high to low, or from low to high.
The TIMER macro should contain code for whatever action you need to take.
But keep this as short as possible, such as setting or clearing flags or incrementing counters.
You have a couple of options for calculating the interrupt rate.
If the interrupts are relatively infrequent, or slow, then start and stop a timer in the input interrupt routine.
If the interrupts are "fast" then increment a counter in the interrupt, then use a fixed regular timer interrupt to sample these counts in order to calculate a frequency.
Hope that helps
The macro "TIMER" will get called whenever PC3 state changes from high to low, or from low to high.
The TIMER macro should contain code for whatever action you need to take.
But keep this as short as possible, such as setting or clearing flags or incrementing counters.
You have a couple of options for calculating the interrupt rate.
If the interrupts are relatively infrequent, or slow, then start and stop a timer in the input interrupt routine.
If the interrupts are "fast" then increment a counter in the interrupt, then use a fixed regular timer interrupt to sample these counts in order to calculate a frequency.
Hope that helps
-
- Valued Contributor
- Posts: 997
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 190 times
- Been thanked: 217 times
Re: STM32f303 interrupt
Hi Oscar
I don't know your application, can you just take a look at the pdf.
Depending on the signal, the resistors are useful. Please note + - input from the comparator.
regards
Stefan
I don't know your application, can you just take a look at the pdf.
Depending on the signal, the resistors are useful. Please note + - input from the comparator.
regards
Stefan