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

Problem with GliterFilterTime


  • Please log in to reply
7 replies to this topic

#1 Charles

Charles

    Advanced Member

  • Members
  • PipPipPip
  • 192 posts

Posted 27 November 2010 - 10:05 PM

Ok... I do this:

TimeSpan gfIgnoreTime = new TimeSpan(0, 0, 0, 0, 100); // 100 Milliseconds.
Cpu.GlitchFilterTime = gfIgnoreTime;

And get this:


#### Exception System.ArgumentException - 0xfd000000 (2) ####
#### Message:
#### Microsoft.SPOT.Hardware.Cpu::set_GlitchFilterTime [IP: 0000] ####
#### NetduinoTelnetServer.HardwareInteraction::.ctor [IP: 002f] ####
#### NetduinoTelnetServer.Config::.ctor [IP: 0004] ####
#### NetduinoTelnetServer.Program::.cctor [IP: 0003] ####
Uncaught exception
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message:
#### NetduinoTelnetServer.Program::Main [IP: 000a] ####
Uncaught exception


Any ideas why??

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 27 November 2010 - 10:23 PM

Hi Charles, The GlitchFilter works differently on smaller .NET MF platforms like Netduino. Instead of measuring an amount of time, the glitch filter simply samples the value a few times. If they all match, the value is good. So setting the GlitchFilterTime will not do anything on the Netduino... If you want more advanced glitch filtering, you could modify the Netduino firmware to use the other method or you could create a higher-level glitch filter in C#. Does that help? Chris

#3 Charles

Charles

    Advanced Member

  • Members
  • PipPipPip
  • 192 posts

Posted 27 November 2010 - 10:32 PM

Well, my problem is that I am getting button bouncing both with the glitch filter true and false. It seems to make absolutely no difference. I assumed it was because the default timeout was too short, but in light of your explanation, it would appear that the glitch filter is simply not working. Not that it's a big deal... Simply adding a capacitor corrected the issue. It's just the principle of the thing...

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 27 November 2010 - 10:49 PM

Well, my problem is that I am getting button bouncing both with the glitch filter true and false. It seems to make absolutely no difference. I assumed it was because the default timeout was too short, but in light of your explanation, it would appear that the glitch filter is simply not working.


The "simplified" .NET MF glitch filter will filter out many glitches...but not all. You'll want to add a layer of software intelligence on top of it fot the components you're using...

Chris

#5 Charles

Charles

    Advanced Member

  • Members
  • PipPipPip
  • 192 posts

Posted 27 November 2010 - 10:59 PM

After a bit of experimentation it turns out that the glitch filter is working, just with too short of an interval for the (apparently very noisy) switch I was using. A combination of the glitch filter and a random capacitor I had on hand (10 uF, probably way bigger than necessary) is working perfectly.

#6 Charles

Charles

    Advanced Member

  • Members
  • PipPipPip
  • 192 posts

Posted 27 November 2010 - 11:47 PM

Actually, I really like the activation delay I get with the 10uF... It is perfect for my needs. I will probably do it up right if this thing ever makes it out of the lab though. http://www.all-elect...ic/debounce.htm

#7 Rod Lopez

Rod Lopez

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationSweden

Posted 12 April 2011 - 02:14 PM

Hi guys, It seems to me like it would be great to be able to choose the de-bouncing algorithm. Charles makes a good point (and a great post) on how to do debouncing, but it does add to the complexity and cost of a prototype board. ...plus you may not not have the right ICs at hand. I would love to be able to throw cycles to the problem (at the cost of memory and perf) rather than having to change the board layout/part list if that'd be possible. For a final product it might not matter all that much, but in the prototyping stages it is handy to just have these things working out-of-the-box :)

#8 Rod Lopez

Rod Lopez

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationSweden

Posted 13 April 2011 - 12:19 PM

I ended up writing something like this:

	static DateTime lastTrackerSwitch = new DateTime();
	static void OnTrackerSwitchButton(uint data1, uint data2, DateTime time)
	{
		if (time.Ticks - lastTrackerSwitch.Ticks < 150 * System.TimeSpan.TicksPerMillisecond)
			return;
		else
			lastTrackerSwitch = time;

		//Here goes your code, being called after debouncing
does that seem sane?




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.