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.

j2inet

Member Since 10 Mar 2013
Offline Last Active Apr 22 2013 06:08 PM
-----

Topics I've Started

High Resolution Delay

09 April 2013 - 02:00 PM

I wanted to check and see if this is something that is reasonably possible on a Netduino Plus 2 before I try to work it into a solution. I need to interface to a device that uses serial communication. The device is usually sleeping, but when I need to send it a message I've got to pulse a wake up line for 50 to 100 ?s and then start sending my message 9 to 11 ?s later. As far as I can tell the only delay functionality available on the netduino takes time in ms, not ?s. I thought about doing a busy loop and probing a clock, but from what I can tell I can't get information in the needed resolution to do this with the clock. 

 

Is this something that I could do with the Netduino Plus 2 or should I seek a different solution?


Code only appears to execute when breakpoint is set

04 April 2013 - 08:10 PM

I've set up a PWM in my code that's going to be controlling a servo. 

 

PWM throttlePort2 = new PWM(PWMChannels.PWM_PIN_D11, 2000, 0.0, false);//throttlePort2.Frequency = 2000;//throttlePort2.DutyCycle = 0;throttlePort2.Start();

 

I've set up an event handler for incoming data from a COM port. Data is sent about 4 to 8 times per second depending on conditions. When that data is received I'm using it to alter the duty cycle on the PWM. 

 

double _throttlePosition;public double ThrottlePosition{    get { return _throttlePosition; }    set     {        if (value != _throttlePosition)        {            _throttlePosition = value;            if (throttlePort != null)                throttlePort.DutyCycle = _throttlePosition;        }    }}

 

When the code is running the PWM doesn't ever appear to be altered. If I set a breakpoint here and allow the code to continue immediately after the breakpoint then it executes fine. But it only seems to execute under this condition. In verifying what was going on I tried using the PWM on the onboard led and also tried with a speaker connected to the PWM pin. Both yield the same results. Is there anything I'm doing wrong?

 

I found another thread from 2 years ago about an odd behaviour (bug?) that occurs if you don't empty the read buffer (http://forums.netdui...recieved-event/). But I don't know if it is applicable given the way that I am reading from the port. 

 

void OnControlDataReceived(object sender, SerialDataReceivedEventArgs e){    while (_controlPort.BytesToRead > 0)    {        int bytesToReadCount = _controlPort.BytesToRead;        int bytesRead = _controlPort.Read(                          _receiveBuffer,                           _receiveBufferLocation,                           _controlPort.BytesToRead            );        _receiveBufferLocation += bytesRead;        CheckBufferForFlush(); //<-- some stuff happens here                                //to empty _receiveBuffer    }}

 

 


Unable to reset Netduino

03 April 2013 - 01:58 AM

I have 4 Netduino Plus 2 units and I've repeated this on three of them (I'm afraid to try it on my last one). 

 

In stepping through a program the only thing that executes is the first line of the program, which is the following:

 

var controlPort = new SerialPort(SerialPorts.COM1, 38400, Parity.None,8,StopBits.One);

 

 

After that execution never returns and I can no longer use the device at all. Attempting to deploy from Visual Studio 2012 results in the error "Unable to communicate with device USB:Netduino"

 

The output to the deployment process follows. 

 

Looking for a device on transport 'USB'Starting device deployment...Iteration 0Opening port ?USB#VID_22B1&PID_1000#000000000000#{09343630-a794-10ef-334f-82ea332c49f3}OperationsAttaching debugger engine...... cannot attach debugger engine!

 

MFDeploy doesn't seem to be able to do much either. If I select "Connect" from the menu I do get back the positive response "Connected." Checking for device capabilities causes the response "Not Supported" to be returned. Trying to ping the device results in "No Connection." So I tried to do a firmware reset. 

 

I connected the 3v line to the expost contact next to GPIO #0. Nothing happens, the device doesn't reset.  When I've done resets before I've been able to use the SAM-BA tool to reflash the device once it shows as a serial device. But this never shows up as a Serial device. It still shows up as a USB Netduino device. 

 

Is there any other way to reset the device?

 


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.