Netduino home hardware projects downloads community

Jump to content


Photo

Unable to deploy without disconnect\reconnect USB cable


  • Please log in to reply
27 replies to this topic

#21 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 17 September 2011 - 05:48 AM

Hi Scott, We tried the firmware both ways, but each has different side effects. Once the .NET MF 4.2 RTM ships (in a few days, with a little luck) we'll build a few versions and test them in the community. Once the issue is resolved, we'll ship official .NET MF 4.2 firmware for all three Netduinos...and likely an updated and signed driver as well. Chris

#22 Scott Green

Scott Green

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts

Posted 07 November 2011 - 05:27 AM

Chris, Has there been any real progress on getting this bug fixed? This first report I see of this on Codeplex was way back in June and it doesn't look like any progress has been made towards resolution. Does the forum software have the ability to take a vote? Seems like it would be good to know how many people are affected by this bug. Scott...

#23 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 November 2011 - 07:42 AM

Hi Scott,

Has there been any real progress on getting this bug fixed? This first report I see of this on Codeplex was way back in June and it doesn't look like any progress has been made towards resolution.

Does the forum software have the ability to take a vote? Seems like it would be good to know how many people are affected by this bug.

The issue was at least partially resolved by the new 4.2 beta drivers and the new way that the 4.2 RC3 firmware resets the board. If you're having the same issue using .NET MF 4.2 on the board...then please raise the issue on CodePlex again... It may be specific to certain types of USB/computer hardware configurations.

Chris

#24 Jarrid

Jarrid

    New Member

  • Members
  • Pip
  • 1 posts

Posted 18 June 2012 - 01:14 AM

I know the last post was very long ago, but I had the same problem and think I have a solution. I was coding everything in separate threads and allowing Main() to end, with the remaining threads actually doing the work. With a lot of trial and error, I finally decided to let Main() live forever, even though the thread had no work left to be done. Once I placed Thread.Sleep(Timeout.Infinite); at the end of Main(), I have never had to reset my USB connection. Hope this is helpful.

#25 econjack

econjack

    New Member

  • Members
  • Pip
  • 1 posts

Posted 24 December 2013 - 09:15 PM

Jarrid:

 

Your solution worked for me, too, and I had the same problem almost two years after this thread started!

 

Thanks for the help!



#26 trth

trth

    New Member

  • Members
  • Pip
  • 3 posts

Posted 10 February 2016 - 05:03 AM

I just bought a Netduino 3 and seem to be having a similar problem.  

 

I tried the "pushing the onboard button" from "getting started with netduino" and a similar thing happen.  

 

Sequence of what happens:

-I upload the program to the netduino 

-I press and release the onboard button

-The computer makes the USB disconnect sound

-The LED turns on for about 5 seconds

-LED turns off

 

If I press and hold the onboard button:

-I press and hold the onboard button

-The computer makes the USB disconnect sound and the onboard LED turns on

-I release the onboard button

-The USB reconnect sound comes from the computer

-The LED stays on for an additional 5 seconds after the button release

-The LED goes out

 

 

Here is the code:

 

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
 
namespace buttonOnboardLED
{
    public class Program
    {
        public static void Main()
        {
            // write your code here
            OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
            InputPort button = new InputPort(Pins.ONBOARD_BTN, false, Port.ResistorMode.Disabled);
 
            bool buttonState = false;
            while (true)
            {
                buttonState = button.Read();
                led.Write(buttonState);
            }
 
        }
 
    }
}
 
Any help would be greatly appreciated!


#27 trth

trth

    New Member

  • Members
  • Pip
  • 3 posts

Posted 10 February 2016 - 05:12 AM

I know the last post was very long ago, but I had the same problem and think I have a solution. I was coding everything in separate threads and allowing Main() to end, with the remaining threads actually doing the work. With a lot of trial and error, I finally decided to let Main() live forever, even though the thread had no work left to be done. Once I placed Thread.Sleep(Timeout.Infinite); at the end of Main(), I have never had to reset my USB connection. Hope this is helpful.

Would you please post an example of code for this?

 

I attempted to add it and get an warning "unreachable code"

 

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
 
namespace buttonOnboardLED
{
    public class Program
    {
        public static void Main()
        {
            // write your code here
            OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
            InputPort button = new InputPort(Pins.ONBOARD_BTN, false, Port.ResistorMode.Disabled);
 
            bool buttonState = false;
            while (true)
            {
                buttonState = button.Read();
                led.Write(buttonState);
            }
            Thread.Sleep(Timeout.Infinite);
        }
    }
}


#28 KiwiDev

KiwiDev

    Advanced Member

  • Members
  • PipPipPip
  • 100 posts
  • LocationNew Zealand

Posted 26 February 2016 - 07:45 AM

Hi 

 

Sorry about the late response I missed you post

 

 while (true)
            {
                buttonState = button.Read();
                led.Write(buttonState);
            }
            Thread.Sleep(Timeout.Infinite);
 
The unreachable code is the Thread.Sleep the while (true) loop will execute forever and won't exit.
 
If you want to do event driven version the code would look something like
 
@KiwiBryn
blog.devmobile.co.nz
 
   {
      public static void Main()
      {
         InterruptPort button = new InterruptPort(Pins.ONBOARD_BTN,false,ResistorModes.Disabled, Port.InterruptMode.InterruptEdgeHigh )

         button.OnInterrupt +=button_OnInterrupt;

         Thread.Sleep(Timeout.Infinite) ;
      }

      static void button_OnInterrupt(uint data1, uint data2, DateTime time)
      {
       // Do stuff here 
      }
   }
 
@KiwiBryn
blog.devmobile.co.nz





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.