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

#1 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 18 July 2012 - 12:55 PM

I have reflashed my Netduino Go following the description in this thread:
http://forums.netdui...ployment-issue/

I have used the unofficial firmware chris links to at the bottom of this topic page 1
MainboardFlashUpdates.zip

After that I updated the ShieldBase with the beta 1 firmware found here: Shield Base Firmware v4.2.0.1 (beta 1) Includes PWM bugfixes

All went fine.

I can run the most simple NetduinoGo application without any problems

using System.Threading;

namespace GoTester
{
    public class Program
    {
        public static void Main()
        {
            Thread.Sleep(Timeout.Infinite);
        }
    }
}

See attachment debug_output_1_run.txt for debug ouput of this run

After that the problems start:

1. problem
When I try to rerun the program (stop debugging and run again or ctrl-shift-F5) I get this message: "Cannot find any entrypoint!" in the debug output window, see attachment debug_output_2_run.txt

I can get by this by unplugging the NetduinoGo USB cable from the computer and plug it in again and then run again. But that means I have to unplug and replug the USB cable each time I've made a new build.

2. problem
I reference the ShieldBase.dll and tries to instantiate an OutputPort but I get an exception (see also debug_output_shieldbase_run.txt)
A first chance exception of type 'System.Exception' occurred in NetduinoGo.ShieldBase.dll
An unhandled exception of type 'System.Exception' occurred in NetduinoGo.ShieldBase.dll

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

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

            OutputPort op = new OutputPort(sb.Pins.GPIO_PIN_D0, false);
            
            Thread.Sleep(Timeout.Infinite);
        }
    }
}

The StackTrace reveals it's in the ShieldBase.CreateOutport function it crashes (see StackTrace.png)

Have I missed something?

Attached Files



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 July 2012 - 07:04 PM

Hi kristoffer_o, Let's focus on issue #2 first and get you back up and going... First, can you please check that the Shield Base is connected to socket 5? This error indicates that the mainboard is having trouble communicating with the Shield Base. Perhaps try to unplug the Shield Base for a few moments and reattach it. If that is correct, please try to reflash the Shield Base again. If the update wasn't completely written (or accidentally restarted aftering being completed...and then got interrupted), your Shield Base firmware could be corrupt...which would cause this issue. On issue #1, it appears that no app can be found on your Netduino Go. After we get issue #2 resolved, I can walk you through submitting the app you're deploying and a flash image of your board...so we can recreate the exact same circumstance here. Chris

#3 Lunddahl

Lunddahl

    Advanced Member

  • Members
  • PipPipPip
  • 152 posts
  • LocationEurope, Denmark

Posted 18 July 2012 - 08:16 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. - Ulrik Lunddahl

#4 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 18 July 2012 - 08:23 PM

....If that is correct, please try to reflash the Shield Base again. If the update wasn't completely written (or accidentally restarted aftering being completed...and then got interrupted), your Shield Base firmware could be corrupt...which would cause this issue.


I believe that was part of the problem, did a reflash and now it works if I use shieldBase.Pins.GPIO_D2, but still same exception if I use D0 or D1, so problem 2 is partly solved:)

Problem 1 persists.

#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 July 2012 - 08:33 PM

Hi kristoffer_o,

I believe that was part of the problem, did a reflash and now it works if I use shieldBase.Pins.GPIO_D2, but still same exception if I use D0 or D1, so problem 2 is partly solved:)

Problem 1 persists.

In the current Shield Base firmware, pins D0/D1 are used by the debug serial port. That's so you can deploy code directly to the Shield Base if you want to, an advanced hack for early adopters.

We'll be freeing those up shortly...at which point you'll need to reflash with the sample NETMF firmware if you want to hack away...

For issue #1... I'm headed out for the evening, but Stefan volunteered to write up some quick instructions on how to capture a flash image of your board. If you can do that and send me both the image and your sample app...I'll try to repro when I return tonight.

Chris

#6 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 18 July 2012 - 08:42 PM

For issue #1... I'm headed out for the evening, but Stefan volunteered to write up some quick instructions on how to capture a flash image of your board. If you can do that and send me both the image and your sample app...I'll try to repro when I return tonight.

Oh dear, Chris pulled me into this :)
Let me see if we can fix this.

1. Download and install the "DfuSe USB device firmware upgrade STMicroelectronics extension" from http://www.st.com/st...MO&ClassID=1734
2. Press the onboard button on your Netduino Go! main board and connect it to your PC. It'll start in bootloader modus.
3. Run the "DfuSe Demonstration" application
4. In the "Upload Action" panel, click "Choose" and specify a file name
5. Click "Upload"

It seems strange, that you need to Upload. But it actually uploads the data from the Netduino Go! mainboard to your PC.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#7 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 18 July 2012 - 09:37 PM

Unfortunately I'm not at my computer at the moment, I'll do it as fast as I can within a couple of hours. Appreciate all your help, thanks a lot :-)

#8 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 18 July 2012 - 11:33 PM

Sample app to reproduce issue #1

using System.Threading;

namespace GoTester
{
    public class Program
    {
        public static void Main()
        {   
            Thread.Sleep(Timeout.Infinite);
        }
    }
}

And flash image attached

Attached Files



#9 rcflyair

rcflyair

    New Member

  • Members
  • Pip
  • 7 posts

Posted 19 July 2012 - 04:14 AM

I've got the same issue when creating either an OutputPort or InputPort targeted at the ShieldBase. I haven't tried Analog yet....

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

namespace NetduinoGo_v01
{
    public class Program
    {
        // Create ShieldBase Object
        public static NetduinoGo.ShieldBase sb = new NetduinoGo.ShieldBase(GoSockets.Socket5);

        public static void Main()
        {
            Debug.Print("Main");
            OutputPort D13 = new OutputPort(sb.Pins.GPIO_PIN_D13, false);

            while (true)
            {
               //D13.Write(true);
               //Thread.Sleep(500);
               //D13.Write(false);
               //Thread.Sleep(500);
            }
            //sb.Dispose();


        }

    }
}

I'm not allowed to upload files yet, heh....

#10 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 19 July 2012 - 10:07 AM

I've got the same issue when creating either an OutputPort or InputPort targeted at the ShieldBase. I haven't tried Analog yet....


Hi rcflyair

It looks as you have the same problems as I experience/experienced, I believe your post in this topic is also part of the problem.

One of the pitfalls for me in the update firmware process, was that I had to unplug and plug in again the NetduinoGo every time I had to deploy something new (because of the "cannot find entry point" issue). So after the ShieldBase firmware update, by routine, I just unplugged/plugged in the NetduinoGo, but that made the ShieldBase firmware update start all over and I didn't pay attention to that. So while the ShieldBase firmware update was in progress I uploaded a new program to the NetduinoGo trying to connect to a ShieldBase with incomplete firmware.

So after the ShieldBase firmware update I unplugged the NetduinoGo, unplugged the ShieldBase from the NetduinoGo, replugged the NetduinoGo and deployed a dummy program to the NetduinoGo. After that I could reattach the ShieldBase and I didn't have any problems initialising a new OutputPort.

I don't know if that's your problem, but it's worth a try.

#11 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 19 July 2012 - 11:28 AM

Hi I did a little investigation this morning.

I created a new NetduinoGo application project in an empty solution in Visual Studio 2010 Ultimate

using System.Threading;

namespace GoTesting
{
    public class Program
    {
        public static void Main()
        {   
            Thread.Sleep(Timeout.Infinite);
        }
    }
}

I can run this project several (at least 10) times without having to unplug/replug the NetduinoGo USB cable to the computer, I put a breakpoint in the main method and it gets hit.
I can also put in and initialse a ShieldBase and OutputPort without any problems.

Then I add a second NetduinoGo application project to the solution, and add exactly the same code as first project.
using System.Threading;

namespace GoTesting2
{
    public class Program
    {
        public static void Main()
        {   
            Thread.Sleep(Timeout.Infinite);
        }
    }
}

I don't change the startup project and I don't unplug/replug USB cable

When I press F5 no breakpoint gets hit and it looks as it's trying to deploy GoTesting2 see 2_Projects_Debug_Output_1_run.txt. The dubug session is running and I have to stop it myself.

I try to unplug/replug USB cable, but still no breakpoint is hit, see 2_Projects_Debug_Output_2_run.txt

When I change the startup project to GoTesting2, all seems fine, GoTesting2 breakpoint gets hit and there's no problem when stopping and starting debugging several times.

When I change startup project back to GoTesting: same issue as first time GoTesting was startup project. When I remove GoTesting2, GoTesting is running fine again.

Hmmm! I actually tried this because I became insecure if I had upgraded the NetduinoGo firmware correctly, I believe that I had misunderstood the Upload/Upgrade groupboxes in the DfuSe demo app (thanks Stefan for explaining that you actually upload to your computer :) ), so I did a new NetduinoGo firmware upgrade just to be 100% certain. After that I wanted to reproduce Issue #1 "Cannot find any entrypoint!", but I couldn't, instead the above happened.

so I went back to one of my orginal projects containing a NetduinoGo Class library project and two NetduinoGo application projects, and the same pattern repeated: one of the application projects
couldn't run and the other could, actually it was the one that referenced the class library that could run.

So where does it bring now: I'm able to port my original Netduino project to the NetduinoGo at the current status, so I can move on.

However, I'm still very uncertain that my firmware upgrades are correct, I can't figure out if it's a Visual Studio, a Netduino SDK or a NETMF issue about the startup projects.

If I get some time I'll try to investigate this further.

So what I'm saying is I'll try to move on, with my fingers crossed. I'll report back later how it goes.

Thanks a lot for all your help

Kristoffer

Attached Files



#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 20 July 2012 - 03:55 AM

Hi rcflyair,

I've got the same issue when creating either an OutputPort or InputPort targeted at the ShieldBase. I haven't tried Analog yet....

        public static NetduinoGo.ShieldBase sb = new NetduinoGo.ShieldBase(GoSockets.Socket5);


What socket is your Shield Base plugged into?

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

Chris

#13 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 20 July 2012 - 03:57 AM

Hi kristoffer_o,

Hi I did a little investigation this morning.

I created a new NetduinoGo application project in an empty solution in Visual Studio 2010 Ultimate

Okay, I think that's actually a bug in Visual Studio or the .NET Micro Framework SDK. I'm not sure that it was ever designed with the scenario of having two app projects to deploy within a single solution (and having one selected as the startup project).

If you remove the unused project, does it deploy properly?

BTW, we can ping Microsoft on the multiple-project issue. It may be possible for them to support that scenario, or at least provide an error to the user when compiling projects with multiple 'applications'.

Chris

#14 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 20 July 2012 - 07:13 AM

Hi kristoffer_o, One of our community members (KodeDaemon) pinged me and mentioned that changing the Startup Project to "Current selection" in your solution properties may force Visual Studio to deploy a specific project in a multi-project solution. Can you try this in your multi-project solution? 1. Open up your Solution's Property Pages. 2. Under Common Properties, select the "Startup Project" category. 3. Change the option to "Current selection" (if "Single startup project" is currently selected) Chris

#15 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 20 July 2012 - 07:48 AM

Okay, I think that's actually a bug in Visual Studio or the .NET Micro Framework SDK. I'm not sure that it was ever designed with the scenario of having two app projects to deploy within a single solution (and having one selected as the startup project).

No, that makes perfect sense. But these two projects doesn't know of each other, there's no reference between them and still it looks as though Visual Studio tries to deploy a project that's not used nor referenced by the startup project.

I tried the same with two Console applications and it behaves as I would expect, I can switch between startup projects without any problems. So I don't know what Microsofts intentions are with NETMF projects in Visual Studio, I'm absolutely new to NETMF, but my first impulse was to refer to "normal" Visual Studio behavior.

If you remove the unused project, does it deploy properly?

Yes.

BTW, we can ping Microsoft on the multiple-project issue. It may be possible for them to support that scenario, or at least provide an error to the user when compiling projects with multiple 'applications'.

Ok, I've never done that, but if you tell me what to do, I'll gladly, describe, report or whatever I can do.

I believe it must be a bug since Visual Studios behavior is not consistent, under some circumstances it supports multiple MF app projects and under others it doesn't.

Thanks again :)

#16 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 20 July 2012 - 07:58 AM

I believe it must be a bug since Visual Studios behavior is not consistent, under some circumstances it supports multiple MF app projects and under others it doesn't.


Dumb question but both projects are targetting the right framework version?
I ask as i have had similar issues when one was set to 4.1 and the other was 4.2, but other than that I have never encountered any issues with multiple projects of multiple types such as in the attached image where i have 2 netmf projects, 1 MVC app and 7 class libs.

Nak.

Attached Files



#17 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 20 July 2012 - 08:36 AM

Dumb question but both projects are targetting the right framework version?

That would be my first question if it was someone else who had these issues :)
The answer is yes, I've checked the project files and solution files line by line just to see if that would reveal anything.

I ask as i have had similar issues when one was set to 4.1 and the other was 4.2, but other than that I have never encountered any issues with multiple projects of multiple types such as in the attached image where i have 2 netmf projects, 1 MVC app and 7 class libs.


Which project is your Startup project?

The only thing that seems consistent is a solution with 1 NGO app project runs fine, adding another NGO app project makes the first unrunnable as startup, adding a third project makes the first and second unrunnable and so on, so it's only the last added project that's runnable in a only NGO app project solution. But in another solution with a Class lib and two NGO app projects it's only the first NGO app project I can run, so I can't really conclude anything.

But it's interesting if both NGO app projects in your solution can be set as Startup projects, it might be my NETMF SDK 4.2 installation, it's just the one from the Netduino.com download page, see attachment

Kristoffer

Attached Files



#18 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 20 July 2012 - 09:16 AM

Hi kristoffer_o,

One of our community members (KodeDaemon) pinged me and mentioned that changing the Startup Project to "Current selection" in your solution properties may force Visual Studio to deploy a specific project in a multi-project solution.

Can you try this in your multi-project solution?

1. Open up your Solution's Property Pages.
2. Under Common Properties, select the "Startup Project" category.
3. Change the option to "Current selection" (if "Single startup project" is currently selected)

Chris


Tried it, but same issue :(

#19 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 20 July 2012 - 12:14 PM

Which project is your Startup project?


I have multiple startup projects, the MCV app running on my dev machine and the VendingDevice project

I generally only include other netmf projects as a project reference, to access classes in its namespace, and if it has a Program.cs i would exclude from project and implement it as a separate thread in my main application project.

Just to clarify what you are trying to do is run 2 netmf apps at once, i.e. if it was a console app solution when you hit f5 you would expect 2 console windows to open? If thats the case why would you do that instead of running one of the apps as a separate thread off of the main app?

Nak.

#20 Kristoffer

Kristoffer

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 20 July 2012 - 12:50 PM

Just to clarify what you are trying to do is run 2 netmf apps at once, i.e. if it was a console app solution when you hit f5 you would expect 2 console windows to open? If thats the case why would you do that instead of running one of the apps as a separate thread off of the main app?


Oh yeah I understand this issue might be a little confusing and by now off topic. It was just some observations I accidentally did when I tried to reproduce the issues I had originally (see top topic). So it's definitely not essential to me and nothing I can see any need for.

When I select a project as Startup project in Visual Studio, I would expect that projects Program.Main method to be executed as first method and any other code must be started from there, so it does when I have a solution with only Console application projects, in that I can add as many Console applications as I like and switch between them as Startup projects without any problems. I can't tell whether this not consistent NETMF behavior is intended or it's a bug or whatever, it just confused me. :mellow:




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.