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

Fixed Issue: tight loops may block Visual Studio debugging


  • Please log in to reply
9 replies to this topic

#1 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 01 October 2010 - 07:20 AM

UPDATE: this issue should be remedied in Netduino Plus firmware v4.1.0 update 5. If you are experiencing this issue with an earlier version of the firmware, please update to the newer firmware release.

Thanks to the users who reported this...

We have found that tight loops on the Netduino Plus can prevent Visual Studio and MFDeploy from connecting to the device. This causes the device to run the current Netduino app--but lock out the user. Workaround and recovery are below.

Example problem-causing code:
while(true)
{
    led.Write(true);
}

In the above code, the .NET MF firmware is constantly busy and does not see incoming messages from Visual Studio. It becomes impossible to redeploy a new app, debug, etc. This does not affect a regular Netduino in this way.

This does not damage your device. There is a work-around to this issue (and a recovery procedure if you've been affected). We are in communciation with Microsoft on this issue and are working on a permanent solution (to be incorporated into an upcoming firmware update).

Workaround: add a bit of "sleeptime" to your loop

while(true)
{
    led.Write(true);
    Thread.Sleep(1); // by sleeping for 1ms, .NET MF watches for incoming messages.
}
Recovery procedure: erasing your Netduino app (necessary if your Netduino Plus is not responding to the PC)
  • Unplug your Netduino from the PC (and external power if present)
  • Start the MFDeploy.exe application (Start > Programs > .NET Micro Framework 4.1 > Tools > MFDeploy.exe)
  • Select USB transport
  • Hold down the pushbutton on your Netduino Plus
  • Without letting go of the pushbutton, plug your Netduino Plus into your PC
  • Within 5 seconds, press PING in MFDeploy. You should see "Pinging...TinyBooter"
  • Press ERASE in MFDeploy. This will erase your Netduino application (and nothing else). Wait for completion.
  • Disconnect and reconnect your Netduino Plus. You should be able to deploy another app.

NOTE: an alternative workaround is to erase and reflash your Netduino Plus (using regular Netduino firmware). This is not recommended, however, as the Netduino Plus would then lose its SD and Ethernet capabilities.

Chris

#2 hari

hari

    Advanced Member

  • Members
  • PipPipPip
  • 131 posts

Posted 01 October 2010 - 01:33 PM

We have found that tight loops on the Netduino Plus can prevent Visual Studio and MFDeploy from connecting to the device. This causes the device to run the current Netduino app--but lock out the user. Workaround and recovery are below.

Thank you for hunting this down and the workaround! That was really annoying!

#3 Corey Kosak

Corey Kosak

    Advanced Member

  • Members
  • PipPipPip
  • 276 posts
  • LocationHoboken, NJ

Posted 04 October 2010 - 12:12 AM

I can confirm that your "pushing the button" HowTo at http://www.netduino.com/projects/ has this issue. This HowTo should probably be changed so it doesn't trip up other first-time Netduino Plus users like it did me. Along the same lines, I find that "the button revisited" demo as written sometimes hangs on the "Rebooting..." step through multiple repetitions of stopping and restarting the program. I find it works much more reliably to use while(true) { Thread.Sleep(100); } rather than Thread.Sleep(Timeout.Infinite);

#4 Chris Seto

Chris Seto

    Advanced Member

  • Members
  • PipPipPip
  • 405 posts

Posted 04 October 2010 - 01:16 AM

Hmm... I'm still having problems with Deploying to my Netduino. No tight loops, just an event driven method called at 20Hz.

#5 NaturallyResistant

NaturallyResistant

    New Member

  • Members
  • Pip
  • 2 posts

Posted 05 October 2010 - 09:06 PM

I have also had trouble deploying to the Netduino Plus. One thing that I've noticed is that I only have an issue if I have a MicroSD card inserted (even though my test code below does not mount or access the card).
public static void Main()
{
    while (true)
    {
        led.Write(true);
        Thread.Sleep(250);
        led.Write(false);
        Thread.Sleep(250);
    }
}

The MicroSD card is from SanDisk (2 GB, just purchased today). If I remove it, the code deploys without issue.

Will post more if I discover anything else.

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 05 October 2010 - 09:08 PM

I have also had trouble deploying to the Netduino Plus. One thing that I've noticed is that I only have an issue if I have a MicroSD card inserted (even though my test code below does not mount or access the card).


Hi NaturallyResistant,

Thanks for the feedback and welcome to the Netduino community!

Have you upgraded to the v4.1.0.4 firmware? It should throw an exception if the card is not SPI compatible (instead of requiring that the card be removed).

Also, if you format the card on your PC (with FAT16 or FAT32) and re-insert it in your Netduino, does it work alright?

Finally, do you have a PN for the MicroSD card? We've used Sandisk cards that work great, so this is interesting...

Chris

#7 NaturallyResistant

NaturallyResistant

    New Member

  • Members
  • Pip
  • 2 posts

Posted 05 October 2010 - 11:36 PM

Hi NaturallyResistant,

Thanks for the feedback and welcome to the Netduino community!

Have you upgraded to the v4.1.0.4 firmware? It should throw an exception if the card is not SPI compatible (instead of requiring that the card be removed).

Also, if you format the card on your PC (with FAT16 or FAT32) and re-insert it in your Netduino, does it work alright?

Finally, do you have a PN for the MicroSD card? We've used Sandisk cards that work great, so this is interesting...

Chris


I had upgraded the firmware. Your suggestion of formatting the card seems to have fixed everything. I had verified that it was formatted as FAT before using it so I'm not sure what's different, but I'm sure glad to be able to start working with the Netduino Plus now. Thanks!

#8 Marco Zora

Marco Zora

    New Member

  • Members
  • Pip
  • 8 posts

Posted 19 March 2012 - 03:58 PM

i have same problem, netduino plus is blocked after a loop: while(true) { SPIbus.Write(Wbuffer); } during my SPI speed test, i have selected SPI speed to 80000 kHz (80 MHz) !!! :-) and the system is stuck!

#9 Marco Zora

Marco Zora

    New Member

  • Members
  • Pip
  • 8 posts

Posted 19 March 2012 - 04:12 PM

I noticed that the maximum possible speed for the SPI clk is about 48 MHz !!! (netduino plus) The SD card SPI clk i fixed to about 11.8 MHz. any of you know how to select the speed of SD card bus to a different frequency?

#10 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 19 March 2012 - 04:28 PM

during my SPI speed test, i have selected SPI speed to 80000 kHz (80 MHz) !!! :-) and the system is stuck!

Please note the maximum SPI clock is 48 MHz (i.e. Master Clock (MCK) provided to all the peripherals).




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.