I upgraded my firmware and software to V4.1.6 on the EMX, but since then I keep on getting an exception on my buttons PIN4, PIN30 and PIN0 when trying to assign its interrupt status - can someone please assist…
Thanks!
MICROSOFT.SPOT.HARDWARE exception
My device is on 4.1.6 and my GHI Assemblies - except for the Microsoft assemblies.
Here is a simple example - as I stated - this used to work till I upgraded…
Thanks!
using System;
using System.Text;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
namespace TestPins
{
public sealed class ButtonsPins
{
private InterruptPort port;
public ButtonsPins()
{
HardwareProvider hwProvider = new HardwareProvider();
Cpu.Pin pinDown = Cpu.Pin.GPIO_Pin0;
try
{
port = new InterruptPort(pinDown, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
}
catch (Exception err)
{
err.ToString();
}
}
}
}
Hi Mike - no I have not - I will quickly do so, and update if it solves my problem - I only checked the Referenced assemblies versions to make sure they are all V4.1.6 - but I will quickly try this.
Sorry my mistake - I forgot one line of code - see amended…
This gives the exact error I get every time:
And to be clear I did try to assign EMX.Pin directly but the error persist…
using System;
using System.Text;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
namespace TestPins
{
public sealed class ButtonsPins
{
private InterruptPort port;
public ButtonsPins()
{
HardwareProvider hwProvider = new HardwareProvider();
Cpu.Pin pinDown = Cpu.Pin.GPIO_Pin0;
[b]pinDown = hwProvider.GetButtonPins(Button.VK_DOWN);[/b]
try
{
port = new InterruptPort(pinDown, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
}
catch (Exception err)
{
err.ToString();
}
}
}
}
As stated - I tried without Hardware Provider as well (and the error persists) - see code below:
using System;
using System.Text;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using GHIElectronics.NETMF.Hardware;
namespace TestPins
{
public sealed class ButtonsPins
{
private InterruptPort port;
public ButtonsPins()
{
Cpu.Pin pinDown = EMX.Pin.IO0;
try
{
port = new InterruptPort(pinDown, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
}
catch (Exception err)
{
err.ToString();
}
}
}
}
Please start a new “console” project and add the code to use the pin. I bet it will work but if not post the complete code here please. I need to see “main” in code please
You are absolutely right - after creating a new project from scratch this class works perfect - I will now extract all my code to this new project and maybe all will be fine…
It just does not make sense why after upgrading my versions this suddenly started to happen…
But thanks for the assistance!
using System;
using Microsoft.SPOT;
using GHIElectronics.NETMF.Hardware;
using Microsoft.SPOT.Hardware;
using TestPins;
namespace EMXTestPins
{
public class Program
{
public static void Main()
{
ButtonsPins tempPins = new ButtonsPins();
}
}
}
using System;
using System.Text;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT;
using GHIElectronics.NETMF.Hardware;
namespace TestPins
{
public sealed class ButtonsPins
{
private InterruptPort port;
public ButtonsPins()
{
Cpu.Pin pinDown = EMX.Pin.IO0;
try
{
port = new InterruptPort(pinDown, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
}
catch (Exception err)
{
err.ToString();
}
}
}
}