Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: RF noise causing spurious interrupts

  1. #1
    Junior Member
    Join Date
    Feb 2016
    Posts
    10

    RF noise causing spurious interrupts

    I want to know if there is a way to check an interrupt pending flag while in an interrupt.
    My circuit board is getting interrupts on a signal that's going to my board, and this has been verified by a practicing electrical engineer. They have tried several methods to clamp down on the noise, but it seems to be coming through the ground plane, and I can see it on my scope, on the order of 5nano seconds of noise.

    I would like to debounce this, but by the time I am in the interrupt, the pin state has already changed. I have to trigger on the leading edge of this pulse for proper timing with the machinery. If I could measure the pulse width, I could debounce that way.

    I can't find a way to check for pending interrupts while inside the ISR. What I'd like to do is enter the IRQ, check pin status, then check for pending.

    My current solution is to throw out interrupts that happen out of sequence with other signals, but sometimes this doesn't work, in maybe .05% of the cases.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,858
    Only looking as far as the PJRC sources I find this (with a manual pointer) in : \hardware\teensy\avr\cores\teensy3\kinetis.h ::
    Code:
    // Nested Vectored Interrupt Controller, Table 3-4 & ARMv7 ref, appendix B3.4 (page 750)
    
    //…
    
    #define NVIC_IS_PENDING(n)	(*((volatile uint32_t *)0xE000E200 + ((n) >> 5)) & (1 << ((n) & 31)))

  3. #3
    Junior Member
    Join Date
    Feb 2016
    Posts
    10
    Quote Originally Posted by defragster View Post
    Only looking as far as the PJRC sources I find this (with a manual pointer) in : \hardware\teensy\avr\cores\teensy3\kinetis.h ::
    Code:
    // Nested Vectored Interrupt Controller, Table 3-4 & ARMv7 ref, appendix B3.4 (page 750)
    
    //
    
    #define NVIC_IS_PENDING(n)	(*((volatile uint32_t *)0xE000E200 + ((n) >> 5)) & (1 << ((n) & 31)))
    Interesting. I see that:
    Code:
    Interrupt set-pending bits. For SETPEND[m] in NVIC_ISPRn, allows interrupt 32n + m to be accessed.
    Is "n" the interrupt number? That define would seem to evaluate to E000E200, assuming one specified an interrupt in the range of 0-31. I'm obviously missing something.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,858
    not noted what Teensy is in use … in that same file : \hardware\teensy\avr\cores\teensy3\kinetis.h

    Are "enum IRQ_NUMBER_t" of the processor interrupts and the value 'n' is the one for the interrupt vector at hand it seems based on use elsewhere in the code.

    Not made clear but seems this is a PIN interrupt? Pin interrupts are reported for the whole port - for pins on port B this would be the n value 'IRQ_PORTB', if it is another device or port that should be the needed info.

  5. #5
    Junior Member
    Join Date
    Feb 2016
    Posts
    10
    Quote Originally Posted by defragster View Post
    not noted what Teensy is in use … in that same file : \hardware\teensy\avr\cores\teensy3\kinetis.h

    Are "enum IRQ_NUMBER_t" of the processor interrupts and the value 'n' is the one for the interrupt vector at hand it seems based on use elsewhere in the code.

    Not made clear but seems this is a PIN interrupt? Pin interrupts are reported for the whole port - for pins on port B this would be the n value 'IRQ_PORTB', if it is another device or port that should be the needed info.
    Thanks for the reply. This is for Teensy 3.2. Pin number (Teensy) 20.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •