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

Unable to deploy to NDP2 after deploying code to test PWM

Unable to deploy

Best Answer xmakina, 05 May 2013 - 07:24 AM

My program above was wrong. Though, it seems firmware 4.3 beta also have it share of bugs. I tried re-flashing to the older firmware version, 4.2.1, and this corrected code ran perfectly. but when I tried it on firmware v4.3,VS does not even hit the breakpoint, and the debugger just exits suddenly without anything happening.

 

I guess that firmware 4.3 beta is still buggy. Reverting back to firmware v4.2.1....

 

This is the correct one:

 

 

 public class Program
    {
        // setup analog input
     
        static SecretLabs.NETMF.Hardware.AnalogInput potentiometer = new
                   secretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);
 
        // use an output port that can handle PWM (pin D5,D6,D9,etc.)
        static PWM pulseWidthModulatedLed = new PWM(PWMChannels.PWM_PIN_D5, 100, 0.5, false); // Set later
     
        public static void Main()
        {
            potentiometer.SetRange(0, 100); // to make this show value in % 
 
            pulseWidthModulatedLed.Frequency = 200;
            pulseWidthModulatedLed.Start();
 
            int potentiometerValue = 0;
            double percent = 0;            
 
            while (true)
            {
                // By default, Read() will return int type from 0-1023 by default
                // But here, the range was customized to return values 
                // from 0, 100
                potentiometerValue = potentiometer.Read();
 
                // divide the read integer value to get the decimal value
                percent = potentiometerValue / 100.0; 
 
                // dutycycle(a double type) needs a value from 0 to 1
                pulseWidthModulatedLed.DutyCycle = percent;
             
            }
        }
    }
Go to the full post


  • Please log in to reply
2 replies to this topic

#1 xmakina

xmakina

    Member

  • Members
  • PipPip
  • 13 posts

Posted 05 May 2013 - 07:23 AM

Hi,

 

I am unable to deploy to NDP2 after deploying my code that tests the pulse width modulator.

Error was "There were deployment errors". Tried to restart the PC, disconnected and reconnected the NDP2, but to no avail.

 

 

namespace AnalogPulseWidthModulation
{
    public class Program
    {
        // setup analog input
        static SecretLabs.NETMF.Hardware.AnalogInput potentiometer = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);
        static SecretLabs.NETMF.Hardware.PWM pulseWidthModulatedLed = new SecretLabs.NETMF.Hardware.PWM(Pins.GPIO_PIN_D0);
     
        public static void Main()
        {
            potentiometer.SetRange(0, 100); // to make this show value in % 
 
            int potentiometerValue = 0;
 
            while (true)
            {
                // By default, Read() will return 0-1023 by default
                // But here, the range was customized to return values 
                // from 0, 100
                potentiometerValue = potentiometer.Read();
                pulseWidthModulatedLed.SetDutyCycle((uint)potentiometerValue);                
            }
        }
    }
}
 

I tried to re-flash as suggested above. But when I got to "Device Capabilities" it said "Not Supported", I have .NET Microframework SDK 4.3 (RTM) and Netduino SDK v4.2.2.

 

What should I do ? Was there any problem in my code that made the NDP2 stop responding ?

 

Thanks and regards,

 

xMakina



#2 xmakina

xmakina

    Member

  • Members
  • PipPip
  • 13 posts

Posted 05 May 2013 - 07:24 AM

UPDATE: 

 

I have already re-flashed. Now I can ping it, and it now responds when I click the "Device Capabilities". Then I encountered this:

 

Error 1 Cannot deploy the base assembly 'mscorlib', or any of his satellite assemblies, to device - USB:Netduino twice. Assembly 'mscorlib' on the device has version 4.3.0.0, while the program is trying to deploy version 4.2.0.0
 

So I changed my project's  target framework to 4.3 and I can now deploy to NDP2 successfully But when the program runs, nothing happens except the on-board LED lights up constantly.(In my program, I don't even have any mention of the on-board led.) Also, VS suddenly exits the debug mode and nothing's happening.

 

Do you think this has something to do with the new firmware ?

 

Pinging... TinyCLR

Pinging... TinyCLR
Pinging... TinyCLR
 
Also, where do I download the firmware files itself , not the source files , as I am not familiar with C++ ? (I assume the .DFU file is the firmware right? )
 
I tried to re-flash again, and the on-board light went off. But when I ran the program again, it lit up again. (Again, In my program, I don't even have any mention of the on-board led.)

 

 

Thanks,

 

xMakina



#3 xmakina

xmakina

    Member

  • Members
  • PipPip
  • 13 posts

Posted 05 May 2013 - 07:24 AM   Best Answer

My program above was wrong. Though, it seems firmware 4.3 beta also have it share of bugs. I tried re-flashing to the older firmware version, 4.2.1, and this corrected code ran perfectly. but when I tried it on firmware v4.3,VS does not even hit the breakpoint, and the debugger just exits suddenly without anything happening.

 

I guess that firmware 4.3 beta is still buggy. Reverting back to firmware v4.2.1....

 

This is the correct one:

 

 

 public class Program
    {
        // setup analog input
     
        static SecretLabs.NETMF.Hardware.AnalogInput potentiometer = new
                   secretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);
 
        // use an output port that can handle PWM (pin D5,D6,D9,etc.)
        static PWM pulseWidthModulatedLed = new PWM(PWMChannels.PWM_PIN_D5, 100, 0.5, false); // Set later
     
        public static void Main()
        {
            potentiometer.SetRange(0, 100); // to make this show value in % 
 
            pulseWidthModulatedLed.Frequency = 200;
            pulseWidthModulatedLed.Start();
 
            int potentiometerValue = 0;
            double percent = 0;            
 
            while (true)
            {
                // By default, Read() will return int type from 0-1023 by default
                // But here, the range was customized to return values 
                // from 0, 100
                potentiometerValue = potentiometer.Read();
 
                // divide the read integer value to get the decimal value
                percent = potentiometerValue / 100.0; 
 
                // dutycycle(a double type) needs a value from 0 to 1
                pulseWidthModulatedLed.DutyCycle = percent;
             
            }
        }
    }





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.