cancel
Showing results for 
Search instead for 
Did you mean: 

INTERRUPTS on STM32 F4 discovery

moskovakis
Associate II
Posted on February 18, 2014 at 04:34

Hello Everyone,

I need help to implement 2 different interrupts in order to :

  • detect the falling edge of the signal (1)
  • detect the rising edge of the clock (R3) 120kHz

0690X00000603HEQAY.jpg

Any help will be very appreciated.

Thanks

#em4095 #rfid #interrupts #stm32-f4
4 REPLIES 4
michaelmccartyeng
Associate II
Posted on February 18, 2014 at 17:58

Hello Theo !

On the face of it, it seems that what you want to do is pretty simple. Have a look at

STM32F4xx_DSP_StdPeriph_Lib_V1.3.0\Project\STM32F4xx_StdPeriph_Examples\EXTI\EXTI_Example

You simply enable the correct clocks, then you configure the gpio, then the EXTI and NVIC from there any interrupts will trigger the ISR (interrupt service routine) in stm32f4xx_it.c

I could try to explain it all here but they do a much better job in stm32f4xx_exti.c

 [..] In order to use an I/O pin as an external interrupt source, follow steps

      below:

   (#) Configure the I/O in input mode using GPIO_Init()

   (#) Select the input source pin for the EXTI line using SYSCFG_EXTILineConfig()

   (#) Select the mode(interrupt, event) and configure the trigger

       selection (Rising, falling or both) using EXTI_Init()

   (#) Configure NVIC IRQ channel mapped to the EXTI line using NVIC_Init()

If you dont know what the stdperiph lib is try this

http://www.emcu.it/STM32F4xx/STM32F4-Library/STM32F4-Library.html

It contains examples to do most of what people want to do. The exti example I mentioned does basically exactly what you want, you might have to change some parameters but only a few.

moskovakis
Associate II
Posted on February 19, 2014 at 11:54

Michael,

Thank you soooo much !

I'll make a try as soon as I have read everything !

And post again when I finish

Thank you for your help !

Posted on February 19, 2014 at 17:06

Perhaps you could use the 120 KHz to externally clock a timer, and then have your data signal input capture on one of the channels of the timers, then interrupt on the much slower data rate clock?

If phase alignment is important, input capture both signals with a faster free running timer.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
moskovakis
Associate II
Posted on February 20, 2014 at 11:46

Clive, Thank you for this very useful advices.

Your right, alignment is important for this application (RFID)

So If I've well understood, I configure for example :

Timer 1 and Timer 2 with a ''input-capture'' mode

My question is : How can I know if my code is working or not ?

With the help of the Keil µvision debug session.

Thank you.