Discussion

how to configure pin as interrupt pin

6 292
Hi ,

    Recently i started working on lemaker board. I completed led blinking and switch (which means configuring pin as input and output). now i want to interface some sensors. all sensors having digital output.so i am interfacing in interrupt method. i dont know how to configure one pin as interrupt pin. how to configure pin as interrupt pin?



hnsncxy  
Edited by hnsncxy at Dec 29, 2016 08:48

The lemaker guitar has  supported some sensors, and you can known about it by reading the dts: i2c@b0178000 (Path: linux-actions/arch/arm/boot/dts/lemaker_guitar_bbb_plus.dts), the node use the SIRQ1 to detect the interrupt, i think you can also use it. and the Pin of the SIRQ1 has been connected to the 40-PIN  header, as follows:
EXT_IO.png

How can i enable that pin as interrupt pin?

Because my sensor will give high or low. So i thought of monitor by interrupt method. i am new to this . please suggest.


http://wiki.lemaker.org/How_to_control_the_IO_on_the_SBC_boards
Here are some guide. You can use the wiringLMK o LMK.GPIO to control the PINs. They have same function with wiringPi and RPi.GPIO, so the interrupt is also the same usage.

Hi sir i worked upto now on controllers only. now i started working on lemaker guiter board.  for interrupt pin i connected one sensor(motion sensor output is digital) for that  my plan is like this..


Static  int __init init_function( void )
{
    //Here 2 pins will initialize .(1.  One pin for LED,   2. One pin for interrupt)
  return 0;
}       
Static void interrupt_sensor_function(void)
{
// whenever interrupt rises this function will execute.(here I will toggle led)
}
static void __exit exit_function( void )
{
  // clearing the  2 pins
}
module_init( init_function );
module_exit( exit_function );



is it possible like this??..

if interrupt rises means where it will come(function name)...

hnsncxy  
jagadeeshn replied at Dec 30, 2016 01:59
How can i enable that pin as interrupt pin?

Because my sensor will give high or low. So i thought o ...

You can refer to the node below to use the interrupt pin.
  1.                 mpu6515@68{
  2.                         ...
  3.                         interrupt-parent = <&sirq>;
  4.                         interrupts =< 1 0x4 >; /*SIRQ1*/
  5.                         ...
  6.                         ...
  7.                 };
Copy the Code
About the " interrupt-parent" and " interrupt", please check the file "Documentation/devicetree/bindings/interrupt-controller/interrupts.txt"

hnsncxy  
Edited by hnsncxy at Jan 03, 2017 07:03
jagadeeshn replied at Dec 31, 2016 01:47
Hi sir i worked upto now on controllers only. now i started working on lemaker guiter board.  for in ...

You can refer to the Touchscreen driver which use the "SIRQ0" to use "SIRQ1", Eg:  linux-actions-bsp/linux-actions/drivers/input/touchscreen/ft5406/ft5x06.c
  1. #define CFG_FT_USE_CONFIG  1

  2. /* load irq number */
  3. cfg_dts.sirq = irq_of_parse_and_map(of_node, 0);

  4. #if CFG_FT_USE_CONFIG
  5.     ftdev->irq =cfg_dts.sirq;
  6. #endif

  7. static irqreturn_t ft5x06_interrupt( int irq, void *devid)
  8. {
  9.     ...
  10.     ...
  11.     return IRQ_HANDLED;
  12. }

  13. err = request_irq(ftdev->irq, ft5x06_interrupt, \
  14.         IRQF_DISABLED | IRQF_TRIGGER_FALLING, FT5X06_NAME, ftdev);
Copy the Code


You have to log in before you can reply Login | Sign Up

Points Rules