OutputPort write triggers other IO's OnInterrupt

Hi, When i write true then false to at least the following pin numbers 71,9,16 the OnInterrupt event for my at least my buttonUp also gets fired. What could be causing this? Maybe InterruptMode? I have them set up as following:

OutputPort
outputPort = new OutputPort(outputPort = new OutputPort(EMX.Pin.IO71, false);

Button
InterruptPort buttonUp = new InterruptPort(EMX.Pin.IO4, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh);
buttonUp.OnInterrupt += new NativeEventHandler(buttonUp_OnInterrupt);

What are the pins connected to?

They are connected to a FEZ Relay.

When I create an event for another button interrupt e.g. the select button which uses IO30 this event also gets triggered when I write to any OutputPort. I notice that it only happens when write false to the output to switch of the relay. This is probably because my interruptport is set to InterruptEdgeHigh.

Relays or any other inductive devices generate a lot of noise. The built in pull up resistors may not be strong enough when it comes to noise.

Add an external 10K pull up resistors to your input pin and the problem will disappear.

Also make sure you have a reversed biased schottky diode in parallel with the relay coil. This will feed the back EMF generated when the magnetic field collapses back through the coil and NOT back into the FEZ.

That’s unfortunate. I thought that when i use a Fez Relay i would’nt need any other component. It says in the brochure (Fez Relay) that it can be connected directly to any pin on EMX. Where exactly should the new resistor be placed? In between the fez relay and IO pin? I don’t know much of electrical engineering.

The problem is not in the relay.Yes it will work on any IO.

Let me try to explain better. Decent processors, like the ones GHI uses, have a built-in programmable pull up and pull down resistors. Those are in the 100K range or even more. Now, these work for 99% of the applications out there. Now, when you have inductive devices that generate a lot of noise, and you have a pin that is pulled high using over 100K resistor (the built in resistor) then the resistor is too large to keep the signal high when noise is generated. The fix is easy, add a 10K resistor between the pin that is effected by the noise and 3.3V, your switch. This will keep the pin high even if noise was generated from a relay.

With that said, we will also look into this to see if there is anything we can do to eliminate this somehow.

Thank you for the explanation. I will try to fix the problem with the given solution. I will post again with the outcome.

Thanks again.

Hi,

I tried to fix the problem using your advice. However this didn’t solve the problem. But we did find out what’s probably causing the problem. The EMX board is in a cabinet along with the relays, power sources etc. everything is in the same cabinet. The FEZ relays are used to open/close some valves. The power needed by the valves is 24V. The relays succesfully open and close the valves. When the valve is closed I receive an interrupt on every pin I set to handle in the code. When I disconnect the 24V power on the relays the problem disappears almost completely. Now the interrupts are only hit sporadically. However if I take the board out of the cabinet the problem completely dissapears. Seems there is some interference or power cut or boost when closing the valve that causes the EMX to generate an interrupt. Any idea what the real problem is? We are now going to try and shield every cable and put the EMX in a seperate shielded enclosure. Do you think this will solve the issue?

Can you try to power the relay from a different source and see if this changes?

We now power the FEZ relay using a 5V pin on the EMX. Should we try an external 5V source? The valves are power by an external 24V power source should we also change this?

Since we are not sure, you are running a simple test just to see if we can isolate the problem.
So, keep everything as is and only connect power to relays from a separate 5V power supply. They are still sharing ground. This may not do anything but if it did it may tell us something

I love USB devices, they are Sooooo much nicer than messing with old serial devices trying to get the com parameters set up right between the device and PC. One problem with USB though is it can be susceptible to electrical noise.

Part of the problem stems from its use of a quasi differential signal (that is still ground referenced!) and the fact that you can see quite a difference in ground potential at each end of the cable give the right combination of PC and environmental conditions. Some PCs implementation of USB also leaves a lot to be desired.

Many times using an externally powered USB hub, or powering the USB device separately can be a big help. Using a good quality cable is also a good idea.

You could also have noise getting back into your FEZ through the IO lines you have driving things, this in turn can put enough noise on the ground to through off USB. If you are driving AC loads with the relays put arc snubbers across the contacts, this will reduce RFI a lot. Make sure you don’t have low voltage lines (I/O from FEX, USB cable, etc,) run in parallel with high voltage (AC) lines.

Hope that is of some help