STM32f303 interrupt

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Oscar_T
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

STM32f303 interrupt

Post by Oscar_T »

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
Attachments
HELP_INT.png
HELP_INT.png (103.45 KiB) Viewed 3782 times

LeighM
Valued Contributor
Posts: 447
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 81 times
Been thanked: 243 times

Re: STM32f303 interrupt

Post by LeighM »

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

stefan.erni
Valued Contributor
Posts: 997
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 190 times
Been thanked: 217 times

Re: STM32f303 interrupt

Post by stefan.erni »

Hi Oscar

I don't know your application, can you just take a look at the pdf.
tidu020a.pdf
(1.15 MiB) Downloaded 458 times
Depending on the signal, the resistors are useful. Please note + - input from the comparator.

regards

Stefan
Schmitttriger_Ti_2021-02-17_17-31-25.png
Schmitttriger_Ti_2021-02-17_17-31-25.png (93.79 KiB) Viewed 3773 times

Oscar_T
Posts: 89
Joined: Wed Dec 02, 2020 10:06 am
Location: Italy
Has thanked: 37 times
Been thanked: 10 times

Re: STM32f303 interrupt

Post by Oscar_T »

Hi

thank you so much for the info, tomorrow i will try to implement in circuit and let you know

Regards

Post Reply