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

PWM freezes Netduino in 4.2.0.1 Firmware


  • Please log in to reply
4 replies to this topic

#1 daGuy

daGuy

    New Member

  • Members
  • Pip
  • 3 posts

Posted 30 October 2012 - 01:07 PM

Hi, I recently flashed the newest Firmware (4.2.0.1) and want to use PWM to control some motors. Whenever I create a PWM instance though the whole device freezes and stops being recognized by windows (immediately when the new object is created it seems). I have to then erase it (with the gold pad) and reflash the complete firmware to fix it. I am using the correct SDK (MicroFrameworkSDK_NETMF42_QFE2.msi) and SDK as specified in the firmware upgrade post. Has anyone else experienced this and is there a solution? Am I missing something? Thank you for help and hints! Jens

#2 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 30 October 2012 - 01:40 PM

how much hz are you using? for me it crashes when using < 100. also you dont have to reflash firmware. go into the bootloder mode, than from mf deploy you can erase just your app (next to the ping button)

#3 Gutworks

Gutworks

    Advanced Member

  • Members
  • PipPipPip
  • 363 posts
  • LocationOttawa, Ontario

Posted 30 October 2012 - 04:22 PM

I recently flashed the newest Firmware (4.2.0.1) and want to use PWM to control some motors. Whenever I create a PWM instance though the whole device freezes and stops being recognized by windows (immediately when the new object is created it seems).


I haven't experienced any issues like this with the latest firmware. Can you post a simple code sample and I will try to reproduce it?

Steve

#4 daGuy

daGuy

    New Member

  • Members
  • Pip
  • 3 posts

Posted 30 October 2012 - 10:05 PM

I haven't experienced any issues like this with the latest firmware. Can you post a simple code sample and I will try to reproduce it?

Steve



I actually wrote a new code fragment to test it out and it seems to be working now. I am using this piece:

public class Program
{
	public static void Main()
	{
		PWM pwm = new PWM(PWMChannels.PWM_PIN_D5, 1000, 500, PWM.ScaleFactor.Microseconds, false);

		OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
		Boolean ledState = false;
		while (true)
		{
			led.Write(ledState);
			ledState ^= true;
			Thread.Sleep(500);
		}
	}
}

In retrospect I think I made two mistakes:

1. I used the wrong pin. Wanted to use D5 but started with Cpu.PWMChannel.PWM_5 which Intellisense suggests so very helpfully. I still find it confusing that instead I have to use the wrappers (PWMChannels.PWM_PIN_D5, also for the normal pins)
2. I set the ScaleFactor to Milliseconds and used the values above for period and duration.

So, sorry for the smoke, it seems to work now!

Thank you so much,
Jens

#5 techtoons

techtoons

    New Member

  • Members
  • Pip
  • 2 posts

Posted 16 February 2013 - 06:45 PM

I actually wrote a new code fragment to test it out and it seems to be working now. I am using this piece:

public class Program{	public static void Main()	{		PWM pwm = new PWM(PWMChannels.PWM_PIN_D5, 1000, 500, PWM.ScaleFactor.Microseconds, false);		OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);		Boolean ledState = false;		while (true)		{			led.Write(ledState);			ledState ^= true;			Thread.Sleep(500);		}	}}
In retrospect I think I made two mistakes: 1. I used the wrong pin. Wanted to use D5 but started with Cpu.PWMChannel.PWM_5 which Intellisense suggests so very helpfully. I still find it confusing that instead I have to use the wrappers (PWMChannels.PWM_PIN_D5, also for the normal pins) 2. I set the ScaleFactor to Milliseconds and used the values above for period and duration. So, sorry for the smoke, it seems to work now! Thank you so much, Jens

In your example, what are you using the variable pwm for? It's defined, but doesn't seem to be used.






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.