Kernel module not receiving interrupts properly

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a pulse generator that's supposed to trigger my linux device to take an action, and that pulse goes to an IRQ on my processor.



In the linux device tree the interrupt is represented under this entry



align_trigger 
compatible = "align_trigger";
interrupt-parent = <0x1>;
interrupts = <0x0 0x37 0x4>;
;


So in my kernel module I use this



dtnode = of_find_compatible_node(NULL,NULL,"align_trigger");
if(!dtnode)
printk(KERN_ALERT "Unable to locate devicetree entryn");
else
irq_index = of_irq_get(dtnode,0);
if(irq_index>0)
i = request_irq(irq_index,align_trigger_irq,0,"gxq_03",NULL);
if(i)
printk(KERN_ALERT "Unable to register IRQn");
else
printk(KERN_ALERT "Registed IRQ %dn",irq_index);





And then the IRQ handler I use is this



irqreturn_t align_trigger_irq(int irq,void *ptr, struct pt_regs *regs)
if(max_segment>0)
if(current_segment>=max_segment)
current_segment = 0;
else
current_segment++;

printk(KERN_ALERT "CURRENT SEGMENT: %dn",current_segment);

return IRQ_HANDLED;



So at the moment its not doing much, just reporting when it gets triggered so I can confirm it. The pulse generator is sending interrupts in every 100 us, and I set the max segment to 100.



I checked my log every 10 seconds for 1 minute.



10 Seconds-> CURRENT FRAME: 1



20 Seconds-> CURRENT FRAME: 1



30 Seconds-> CURRENT FRAME: 2



40 Seconds-> CURRENT FRAME: 4



50 Seconds-> CURRENT FRAME: 5



60 Seconds-> CURRENT FRAME: 5



So I am certainly not getting the number of interrupts per second that I ought to be getting, and it doesn't really seem to be a consistent rate being seen by the processor.



The reported IRQ number was 165, so I looked at /proc/interrupts, since that's what's been mentioned on other posts about interrupts. The entry for 165 is this:



 CPU0 CPU1 
165: 8 0 GIC-0 87 Level gxq_03


The only thing I am able to verify is that my pulse generator is putting out pulses at the right rate, but there is alot that could potentially be going wrong in between that and my kernel module registering an interrupt. How can I proceed with debugging what is going wrong?







share|improve this question
























    up vote
    0
    down vote

    favorite












    I have a pulse generator that's supposed to trigger my linux device to take an action, and that pulse goes to an IRQ on my processor.



    In the linux device tree the interrupt is represented under this entry



    align_trigger 
    compatible = "align_trigger";
    interrupt-parent = <0x1>;
    interrupts = <0x0 0x37 0x4>;
    ;


    So in my kernel module I use this



    dtnode = of_find_compatible_node(NULL,NULL,"align_trigger");
    if(!dtnode)
    printk(KERN_ALERT "Unable to locate devicetree entryn");
    else
    irq_index = of_irq_get(dtnode,0);
    if(irq_index>0)
    i = request_irq(irq_index,align_trigger_irq,0,"gxq_03",NULL);
    if(i)
    printk(KERN_ALERT "Unable to register IRQn");
    else
    printk(KERN_ALERT "Registed IRQ %dn",irq_index);





    And then the IRQ handler I use is this



    irqreturn_t align_trigger_irq(int irq,void *ptr, struct pt_regs *regs)
    if(max_segment>0)
    if(current_segment>=max_segment)
    current_segment = 0;
    else
    current_segment++;

    printk(KERN_ALERT "CURRENT SEGMENT: %dn",current_segment);

    return IRQ_HANDLED;



    So at the moment its not doing much, just reporting when it gets triggered so I can confirm it. The pulse generator is sending interrupts in every 100 us, and I set the max segment to 100.



    I checked my log every 10 seconds for 1 minute.



    10 Seconds-> CURRENT FRAME: 1



    20 Seconds-> CURRENT FRAME: 1



    30 Seconds-> CURRENT FRAME: 2



    40 Seconds-> CURRENT FRAME: 4



    50 Seconds-> CURRENT FRAME: 5



    60 Seconds-> CURRENT FRAME: 5



    So I am certainly not getting the number of interrupts per second that I ought to be getting, and it doesn't really seem to be a consistent rate being seen by the processor.



    The reported IRQ number was 165, so I looked at /proc/interrupts, since that's what's been mentioned on other posts about interrupts. The entry for 165 is this:



     CPU0 CPU1 
    165: 8 0 GIC-0 87 Level gxq_03


    The only thing I am able to verify is that my pulse generator is putting out pulses at the right rate, but there is alot that could potentially be going wrong in between that and my kernel module registering an interrupt. How can I proceed with debugging what is going wrong?







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a pulse generator that's supposed to trigger my linux device to take an action, and that pulse goes to an IRQ on my processor.



      In the linux device tree the interrupt is represented under this entry



      align_trigger 
      compatible = "align_trigger";
      interrupt-parent = <0x1>;
      interrupts = <0x0 0x37 0x4>;
      ;


      So in my kernel module I use this



      dtnode = of_find_compatible_node(NULL,NULL,"align_trigger");
      if(!dtnode)
      printk(KERN_ALERT "Unable to locate devicetree entryn");
      else
      irq_index = of_irq_get(dtnode,0);
      if(irq_index>0)
      i = request_irq(irq_index,align_trigger_irq,0,"gxq_03",NULL);
      if(i)
      printk(KERN_ALERT "Unable to register IRQn");
      else
      printk(KERN_ALERT "Registed IRQ %dn",irq_index);





      And then the IRQ handler I use is this



      irqreturn_t align_trigger_irq(int irq,void *ptr, struct pt_regs *regs)
      if(max_segment>0)
      if(current_segment>=max_segment)
      current_segment = 0;
      else
      current_segment++;

      printk(KERN_ALERT "CURRENT SEGMENT: %dn",current_segment);

      return IRQ_HANDLED;



      So at the moment its not doing much, just reporting when it gets triggered so I can confirm it. The pulse generator is sending interrupts in every 100 us, and I set the max segment to 100.



      I checked my log every 10 seconds for 1 minute.



      10 Seconds-> CURRENT FRAME: 1



      20 Seconds-> CURRENT FRAME: 1



      30 Seconds-> CURRENT FRAME: 2



      40 Seconds-> CURRENT FRAME: 4



      50 Seconds-> CURRENT FRAME: 5



      60 Seconds-> CURRENT FRAME: 5



      So I am certainly not getting the number of interrupts per second that I ought to be getting, and it doesn't really seem to be a consistent rate being seen by the processor.



      The reported IRQ number was 165, so I looked at /proc/interrupts, since that's what's been mentioned on other posts about interrupts. The entry for 165 is this:



       CPU0 CPU1 
      165: 8 0 GIC-0 87 Level gxq_03


      The only thing I am able to verify is that my pulse generator is putting out pulses at the right rate, but there is alot that could potentially be going wrong in between that and my kernel module registering an interrupt. How can I proceed with debugging what is going wrong?







      share|improve this question












      I have a pulse generator that's supposed to trigger my linux device to take an action, and that pulse goes to an IRQ on my processor.



      In the linux device tree the interrupt is represented under this entry



      align_trigger 
      compatible = "align_trigger";
      interrupt-parent = <0x1>;
      interrupts = <0x0 0x37 0x4>;
      ;


      So in my kernel module I use this



      dtnode = of_find_compatible_node(NULL,NULL,"align_trigger");
      if(!dtnode)
      printk(KERN_ALERT "Unable to locate devicetree entryn");
      else
      irq_index = of_irq_get(dtnode,0);
      if(irq_index>0)
      i = request_irq(irq_index,align_trigger_irq,0,"gxq_03",NULL);
      if(i)
      printk(KERN_ALERT "Unable to register IRQn");
      else
      printk(KERN_ALERT "Registed IRQ %dn",irq_index);





      And then the IRQ handler I use is this



      irqreturn_t align_trigger_irq(int irq,void *ptr, struct pt_regs *regs)
      if(max_segment>0)
      if(current_segment>=max_segment)
      current_segment = 0;
      else
      current_segment++;

      printk(KERN_ALERT "CURRENT SEGMENT: %dn",current_segment);

      return IRQ_HANDLED;



      So at the moment its not doing much, just reporting when it gets triggered so I can confirm it. The pulse generator is sending interrupts in every 100 us, and I set the max segment to 100.



      I checked my log every 10 seconds for 1 minute.



      10 Seconds-> CURRENT FRAME: 1



      20 Seconds-> CURRENT FRAME: 1



      30 Seconds-> CURRENT FRAME: 2



      40 Seconds-> CURRENT FRAME: 4



      50 Seconds-> CURRENT FRAME: 5



      60 Seconds-> CURRENT FRAME: 5



      So I am certainly not getting the number of interrupts per second that I ought to be getting, and it doesn't really seem to be a consistent rate being seen by the processor.



      The reported IRQ number was 165, so I looked at /proc/interrupts, since that's what's been mentioned on other posts about interrupts. The entry for 165 is this:



       CPU0 CPU1 
      165: 8 0 GIC-0 87 Level gxq_03


      The only thing I am able to verify is that my pulse generator is putting out pulses at the right rate, but there is alot that could potentially be going wrong in between that and my kernel module registering an interrupt. How can I proceed with debugging what is going wrong?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 15 at 19:56









      Zephyr

      206211




      206211

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f424456%2fkernel-module-not-receiving-interrupts-properly%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f424456%2fkernel-module-not-receiving-interrupts-properly%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?