PWM freezes Netduino in 4.2.0.1 Firmware
#1
Posted 30 October 2012 - 01:07 PM
#2
Posted 30 October 2012 - 01:40 PM
#3
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
Twiiter: https://twitter.com/Gutworks
#4
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
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