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

ShieldBase unhandled exception on new OutputPort()


  • Please log in to reply
32 replies to this topic

#21 rcflyair

rcflyair

    New Member

  • Members
  • Pip
  • 7 posts

Posted 20 July 2012 - 03:26 PM

Hi rcflyair,



What socket is your Shield Base plugged into?

Did you upgrade your Shield Base firmware--or is it running the original firmware?

Chris


Morning!

I have the shield base on socket5 and sockets 6 thru 8 left open. The Button, RGBLed, and Pot are on 1,2, and 3...

I've made some progress and have the ShieldBase working now. I downloaded and flashed the ShieldBase with the firmware on your sticky post in this forum -- ShieldBase_ManualUpdate_4.2.0.1b1.zip (183.17K). The update seemed to go fine...

I'm now able to deploy and run my simple app!!! However, if I make any changes to the source and try to re-deploy and run the app, the execution halts with an error "Cannot find entry point". If I cycle the power on the NetduinoGo, then I'm able to deploy and run (until I make a change to the code). If I make no changes to the source, then I am able to repeatedly deploy and run the code....

Loading Deployment Assemblies.

Resolving.

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

Cannot find any entrypoint!

Done.


So at least its functioning now as long as I cycle the power after each source code change. I've tried rebuilding, rebuilding all, deploying without debugging, etc., and still loose the entry point. Something about being freshly powered up seems to make it play nicely with VS.

I sure would like to get rid of this little quirk, but at least it working!

Attached Files



#22 KodeDaemon

KodeDaemon

    Advanced Member

  • Members
  • PipPipPip
  • 63 posts

Posted 20 July 2012 - 03:39 PM

Hi rcflyair, Have you updated your mainboard firmware to the prerelease version Chris posted last week?

#23 rcflyair

rcflyair

    New Member

  • Members
  • Pip
  • 7 posts

Posted 20 July 2012 - 03:56 PM

Hey! At one point I tried that when I was having the original issue with the shieldbase.dll exception, but that was at 3AM and nothing seemed to work, heh. I'll give it a try right now.....

#24 rcflyair

rcflyair

    New Member

  • Members
  • Pip
  • 7 posts

Posted 20 July 2012 - 04:09 PM

Yup, the prerelease mainboard firmware has eliminated the "cannot find entry point" issue. Thanks guys :)

#25 KodeDaemon

KodeDaemon

    Advanced Member

  • Members
  • PipPipPip
  • 63 posts

Posted 20 July 2012 - 04:28 PM

No problem, glad we could help!

#26 Lunddahl

Lunddahl

    Advanced Member

  • Members
  • PipPipPip
  • 152 posts
  • LocationEurope, Denmark

Posted 21 July 2012 - 01:41 PM

I think I have the exact same problem, once an application is deployed, the next time I deploy nothing happens unless I unplug the USB cable and reconnect.

I would like to help nail this error, because it's annoying ass hell, and I can replicate it on both my computers.


My problem is still not resolved.

After some more testing i found that i can debug the same application as many times as i would like, if i change a single comma in the source, the next debug just ends with no errors, and further debugs ends with "Cannot find any entrypoint!"

If i replug the Go, i can deploy the app again, but then the above repeats itself...

Attached is the output from the first debug and the second debug that fails.

The code is blinking a led if a button is pressed, but the Go does this regardless of the code used.

- Ulrik Lunddahl

Attached Files

  • Attached File  1.txt   4.11KB   3 downloads
  • Attached File  2.txt   3.92KB   3 downloads


#27 rcflyair

rcflyair

    New Member

  • Members
  • Pip
  • 7 posts

Posted 21 July 2012 - 02:19 PM

Morning!

I was having the same issue and was able to solve it by flashing the mainboard with the pre-release firmware found here...

Hope it works for you too!

#28 Lunddahl

Lunddahl

    Advanced Member

  • Members
  • PipPipPip
  • 152 posts
  • LocationEurope, Denmark

Posted 21 July 2012 - 03:59 PM

I was having the same issue and was able to solve it by flashing the mainboard with the pre-release firmware found here...


Ohh, i forgot to mention that i have flashed the Go with that firmware, and the problem was not solved.

I get this behavior on both my workstation running Windows Vista, and my notebook running Windows 7.

I'm dry of things to try...

- Ulrik

#29 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 21 July 2012 - 09:01 PM

Hi Ulrik, Can you post the flash image of your mainboard and a copy of some source code which exhibits the issue? Zipped up as a single file as rcflyair did? This is very strange indeed, and we'd be happy to get to the bottom of it. Chris

#30 Lunddahl

Lunddahl

    Advanced Member

  • Members
  • PipPipPip
  • 152 posts
  • LocationEurope, Denmark

Posted 22 July 2012 - 07:38 AM

Can you post the flash image of your mainboard and a copy of some source code which exhibits the issue? Zipped up as a single file as rcflyair did?

This is very strange indeed, and we'd be happy to get to the bottom of it.


Hi Chris!

Sure here goes, i have included two flash images, one after the first deployment that is working, and one where the netduino fails.

The code is here:

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

namespace Blink
{
    public class Program
    {
        public static void Main()
        {
            NetduinoGo.RgbLed rgbLed = new NetduinoGo.RgbLed(GoSockets.Socket4);
            
            while (true)
            {
                rgbLed.SetColor(0, 50, 0);
                Thread.Sleep(100);
                rgbLed.SetColor(0, 0, 0);
                Thread.Sleep(900);
            }
        }
    }
}

1. When i debug this code everything is working fine (working.dfu + working-debug.txt)

2. When i debug again, everything works. I stop debugging, then i change the color of the led to red, and debug again, here it fails (failed.dfu + failed-debug.txt)

Now the netduino is in a state i don't know, just applying power gives med no blinking, neither green or red, no blue LED on gobus socket 4, but using MFDeploy to ping give a response back from TinyCLR fine.

VS 2010 is still open, and hitting debug deploys the app and i get green blinking, i can deploy as many times as i want, but changing a single char in the code, makes it fail again, it's the same behavior regardless of the code used.

Happy digging... ;-)

- Ulrik Lunddahl

Attached Files



#31 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 23 July 2012 - 12:45 PM

As a follow up on the problems I initially had with the ShieldBase and Mainboard firmware, I'm now having some problems writing to an OutputPort.

ShieldBase.dll throws an exception on these two programs on the op.Write\(b\) call

It writes the value to the port (I can see it changes from low to high) and 3-4 seconds later it throws the exception.

Output:
A first chance exception of type 'System.Exception' occurred in NetduinoGo.ShieldBase.dll

Stack Trace:
NetduinoGo.ShieldBase.dll!NetduinoGo.ShieldBase.WriteOutputPort(Microsoft.SPOT.Hardware.Cpu.Pin portId = 1004, bool state = true) Line 282 + 0x44 bytes C#

It makes no difference whether I use an Analog (sb.Pins.GPIO_PIN_A1) or a Digital (sb.Pins.GPIO_PIN_D4) pin
public class Program
{
    private static OutputPort op;
    private static bool b;
    
    public static void Main()
    {
        var sb = new ShieldBase(GoSockets.Socket5);
        op = new OutputPort(sb.Pins.GPIO_PIN_D4, false);
     
        NetduinoGo.Button btn = new Button(GoSockets.Socket1);
        b.ButtonPressed += btn_ButtonPressed;

        Thread.Sleep(Timeout.Infinite);
    }

    static void btn_ButtonPressed(object sender, bool buttonState)
    {
        b = !b;
        op.Write(B);
    }
}
public class Program
{
    private static OutputPort op;
    private static bool b;
    
    public static void Main()
    {
        var sb = new ShieldBase(GoSockets.Socket5);
        op = new OutputPort(sb.Pins.GPIO_PIN_D4, false);

        var ip = new InterruptPort(Pins.Button, false, Port.ResistorMode.Disabled,
                                              Port.InterruptMode.InterruptEdgeHigh);

        ip.OnInterrupt += new NativeEventHandler(switchPort_OnInterrupt);
        Thread.Sleep(Timeout.Infinite);
    }

    static DateTime portLimitSwitchInterruptionTime;
    private static void switchPort_OnInterrupt(uint port, uint data, DateTime time)
    {
        if (portLimitSwitchInterruptionTime.AddMilliseconds(50) > time)
            return;

        portLimitSwitchInterruptionTime = time;

        b = !b;
        op.Write(B);
    }
}

I know the InterruptPort is not enabled on the Shieldbase, but is it the same with the Mainboard?

The following two programs runs fine

public class Program
{
    private static OutputPort op;
    private static bool b;
    
    public static void Main()
    {
        var sb = new ShieldBase(GoSockets.Socket5);
        op = new OutputPort(sb.Pins.GPIO_PIN_D4, false);

        op.Write(true);
        Thread.Sleep(1000);
        op.Write(false);
        
        Thread.Sleep(Timeout.Infinite);
    }
}
public class Program
{
    private static OutputPort op;
    private static InputPort ip;
    private static bool b;
    
    public static void Main()
    {
        var sb = new ShieldBase(GoSockets.Socket5);
        op = new OutputPort(sb.Pins.GPIO_PIN_D4, false);

        ip = new InputPort(Pins.Button, false, Port.ResistorMode.Disabled);

        var t = new Thread(EventListener);
        t.Start();

        Thread.Sleep(Timeout.Infinite);
    }

    private static void EventListener()
    {
        bool currentRead = false;
        
        while (true)
        {
            if (currentRead != ip.Read())
            {
                currentRead = !currentRead;
                
                if(currentRead)
                    TogglePort();
            }
        }
    }

    private static void TogglePort()
    {
        b = !b;
        op.Write(B);
    }
}


#32 Lunddahl

Lunddahl

    Advanced Member

  • Members
  • PipPipPip
  • 152 posts
  • LocationEurope, Denmark

Posted 27 July 2012 - 03:42 PM

Sure here goes, i have included two flash images, one after the first deployment that is working, and one where the netduino fails.

-----8<-----

Happy digging... ;-)

- Ulrik Lunddahl


Any news on this one, i'm still not able to get the Go to run more than one time before re plugging...

- Ulrik

#33 morfrog

morfrog

    New Member

  • Members
  • Pip
  • 1 posts

Posted 01 February 2014 - 03:41 AM

I had this exact problem. The solution is to plugin your ShieldBase (unfortunate if you lack one) - this then runs successfully.

 

It seems that even though the shield base is not plugged in, the code attempts to use it and an exception occurs:

 

StackTrace

NetduinoGo.ShieldBase::.ctor

System.Reflection.ConstructorInfo::Invoke

GoBus.GoBusManager::GetShieldBase

System.Reflection.MethodBase::Invoke

Microsoft.SPOT.Hardware.OutputPort::.ctor

NetduinoGoApplication1.Program::Main  






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.