Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

InterruptPort


  • Please log in to reply
12 replies to this topic

#1 xc2rx

xc2rx

    Member

  • Members
  • PipPip
  • 27 posts

Posted 14 August 2010 - 12:23 AM

Hi, I'm trying to use InterruptPort class on the onboard switch and apparently it's not working. This brought me to question which digital I/O pin supports InterruptPort?? I use to program for the AVR ATMega 168/328 and those 8-bit MCUs have built-in interrupt support for all digital I/O pins. I wonder if this MCU does the same. Please let me know. Thanks, xc2rx

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 August 2010 - 12:41 AM

I'm trying to use InterruptPort class on the onboard switch and apparently it's not working. This brought me to question which digital I/O pin supports InterruptPort??


All pins (plus the pushbutton) can be used as InterruptPorts. Have you had a chance to look at the "event handler" advanced tutorial on the Projects page? Also, there's some sample InterruptPort code by one of our users in the forums...

If you can show us what you're doing in code and what you're trying to accomplish, perhaps we can all take a look and help you sort it out as well...

Chris

#3 xc2rx

xc2rx

    Member

  • Members
  • PipPip
  • 27 posts

Posted 14 August 2010 - 12:55 AM

All pins (plus the pushbutton) can be used as InterruptPorts. Have you had a chance to look at the "event handler" advanced tutorial on the Projects page? Also, there's some sample InterruptPort code by one of our users in the forums...

If you can show us what you're doing in code and what you're trying to accomplish, perhaps we can all take a look and help you sort it out as well...

Chris


Hi Chris,

Yeah, I know how delegates and events work. I've been coding professional for 10+ years. I found out why my InterruptPort wasn't working!! It was the glitchFilter, I set it to true. I remember reading it somewhere that if you set the glitchFilter to true, that will automatically handle switch debouncing for you. Could you clarify the use of this parameter for me as I am confused now. And thanks for the quick reply. You guys are doing great job helping the Netduino community to get started.

xc2rx

#4 dab

dab

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationBellevue, WA, USA

Posted 14 August 2010 - 08:36 PM

Hi Chris,

Yeah, I know how delegates and events work. I've been coding professional for 10+ years. I found out why my InterruptPort wasn't working!! It was the glitchFilter, I set it to true. I remember reading it somewhere that if you set the glitchFilter to true, that will automatically handle switch debouncing for you. Could you clarify the use of this parameter for me as I am confused now. And thanks for the quick reply. You guys are doing great job helping the Netduino community to get started.

xc2rx


Hi xc2rx,

I found the same thing that you did with the glitchFilter parameter. (BTW, I'm the guy who posted the ToggleButton sample that Chris referred to).

In the ToggleButton sample, if I set the InterruptPort's glitchFilter parameter to true, it seems that the interrupts don't fire (or the event associated with the interrupt doesn't fire - not sure which one).

@Chris - is there a way we can investigate this further?
Thanks,
~ David ~

#5 xc2rx

xc2rx

    Member

  • Members
  • PipPip
  • 27 posts

Posted 15 August 2010 - 05:06 PM

Hi xc2rx,

I found the same thing that you did with the glitchFilter parameter. (BTW, I'm the guy who posted the ToggleButton sample that Chris referred to).

In the ToggleButton sample, if I set the InterruptPort's glitchFilter parameter to true, it seems that the interrupts don't fire (or the event associated with the interrupt doesn't fire - not sure which one).

@Chris - is there a way we can investigate this further?


Hi Dab,

Yes your example triggered my mistake. I was coding a switch button example and it didn't work until I saw the difference on your example. Then I turned the glitchFilter parameter off and it worked!! Like I said, i thought the glitchParameter was suppose to be for switch debouncing. If it is turned off, then the programmer is responsible for switch debouncing. If it is turned on, then switch debouncing is being handled automatically. Apparently this is not the case. In my example, when i turned on glitchFilter, no event gets triggered. When I turned it off, it worked perfectly with switch debouncing done automatically. Maybe the value got reversed? true is now false and false is now true? Could someone please investigate what's going on here??

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 15 August 2010 - 05:15 PM

Sure thing. We're looking into the GlitchFilter using InterruptPort (and any possible glitches with the glitch filter)...

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 August 2010 - 12:49 AM

Quick update... We found the problem. A single line of code in the GPIO debouncer code was causing the glitch in the glitchfilter. We have implemented the GlitchFilter fix in the v4.1.0.2 (4.1.0 patch 2) update along with the AnalogInput bugfix. The updated firmware will be posted by tomorrow. Chris

#8 xc2rx

xc2rx

    Member

  • Members
  • PipPip
  • 27 posts

Posted 16 August 2010 - 01:25 AM

Quick update... We found the problem. A single line of code in the GPIO debouncer code was causing the glitch in the glitchfilter.

We have implemented the GlitchFilter fix in the v4.1.0.2 (4.1.0 patch 2) update along with the AnalogInput bugfix. The updated firmware will be posted by tomorrow.

Chris


Can I get credit for that :) hahaha j/k

#9 dab

dab

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationBellevue, WA, USA

Posted 16 August 2010 - 07:30 AM

Quick update... We found the problem. A single line of code in the GPIO debouncer code was causing the glitch in the glitchfilter.

We have implemented the GlitchFilter fix in the v4.1.0.2 (4.1.0 patch 2) update along with the AnalogInput bugfix. The updated firmware will be posted by tomorrow.

Chris


Cool, I'll be sure to try it out (tomorrow).
Thanks,
~ David ~

#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 August 2010 - 07:37 AM

The GlitchFilter bug has been fixed in the new Netduino v4.1.0.2 (patch 2) firmware. Download it at: http://forums.netdui...e-v410-patch-2/ Please let me know how it works for you! [Please note that the GlitchFilter on the Netduino's AT91SAM7X MCU operates a bit differently than other .NET Micro Framework devices. Due to lower system resources, the glitch filter samples the signal three additional times to help avoid interpreting stray signals as state changes and to help eliminate "bouncing" during button presses. The number of samples taken can be changed in the firmware's source code if desired.

#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 August 2010 - 09:16 PM

Can I get credit for that :) hahaha j/k


Oh yes, absolutely. A big thank you to xc2rx for starting this thread and alerting us to the GlitchFilter issue.

Perhaps we could "dedicate" bug fixes to our community members? :)

P.S. Anyone else who alerted us to this issue...thank you as well. I don't want to leave anyone out!

#12 dab

dab

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationBellevue, WA, USA

Posted 17 August 2010 - 12:09 AM

Perhaps we could "dedicate" bug fixes to our community members? :)

Or maybe you could award Fabulous PrizesTM to the top bug finders (like a Netduino board or a trip to Hawaii). :)
Thanks,
~ David ~

#13 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 August 2010 - 12:28 AM

Or maybe you could award Fabulous PrizesTM to the top bug finders (like a Netduino board or a trip to Hawaii). :)


Great idea. You never know what might happen... :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.