I have netduino plus 2 with Firmware v4.2.1 (Update 2) and found two problem with pwm:
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 NetduinoApplication1 { public class Program { public static void Main() { // write your code here OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); PWM M1P = new PWM(PWMChannels.PWM_PIN_D9, 2000, 1000,PWM.ScaleFactor.Microseconds, false); M1P.Start(); while (true) { Thread.Sleep(1000); led.Write(true); Thread.Sleep(1000); led.Write(false); } } } }
1. I try to get PWM with period of 2000 us and duty cycle of 50%, but get 1000us with 50% duty cycle. So, I check diffrent values and I always get half of them (period and duration).
2. I also notice when I wrote program with PWM on pin X and upload it to the microcontroller and then I upload another program that doesn't use the pin X, I still get the last PWM configuration on pin X. (With OutputPort the pins return to the default value)
I don't have scope or logic analyzer and I checked the output with another microcontroller (mbed). (I also check
with mbed PwmOut to verify that the problem is with netduino and not with my check tool). Next week I will test it with a real scope .
am I doing something wrong?
I'm new to netduino so I hope I don't make a stupid mistake...
Sorry for my english....