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

NetduinoGo ShieldBase InterruptPort gives exception


  • Please log in to reply
2 replies to this topic

#1 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 25 May 2012 - 09:17 AM

Hi

When I run this code

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoGo;

namespace ShieldBase
{
    public class Program
    {
        public static void Main()
        {
            NetduinoGo.ShieldBase sb = new NetduinoGo.ShieldBase(GoSockets.Socket5);

            Microsoft.SPOT.Hardware.InterruptPort ip = new InterruptPort(sb.Pins.GPIO_PIN_D7,
                                                                         true,
                                                                         Port.ResistorMode.PullUp,
                                                                         Port.InterruptMode.InterruptEdgeBoth);
            
            ip.OnInterrupt += new NativeEventHandler(ip_OnInterrupt);

            Thread.Sleep(Timeout.Infinite);
        }

        static void ip_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            Debug.Print("ip_OnInterrupt()");
        }
    }
}

This statement gives an exception "An unhandled exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll"

ip.OnInterrupt += new NativeEventHandler(ip_OnInterrupt);

The code (except for the ShieldBase) works perfect for the Netduino. Only other module attached to the NetduinoGo is a button at GoSocket1.

Project properties are:
Deployment – transport: USB
Deployment - Device: NetduinoGo_NetduinoGo.
Target framework is .NET Micro Framework 4.2

I've tried other pins with same result.

Any idea?

Thank you, Kristoffer

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 May 2012 - 01:53 AM

Hi kristoffer_o, InputPort, OutputPort, and TristatePort are enabled on the Shield Base so far. Along with AnalogInput and PWM. The InterruptPort feature isn't enabled quite yet. We'll enable it once we move from the UART to SPI communication channel. In the meantime, you can create a thread which polls the input in the background... Chris

#3 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 26 May 2012 - 10:28 AM

Ok, thanks.




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.