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

Netduino 2 Plus Serial (COM) Port

serial netduino 2 plus netduino com port

  • Please log in to reply
2 replies to this topic

#1 zimmersm

zimmersm

    New Member

  • Members
  • Pip
  • 1 posts

Posted 02 May 2014 - 10:04 PM

Hi everyone, 

I am experiencing a kind of odd problem having to do with SerialPort on the Netduino 2 Plus.  In a black project, I can successfully create, open, and write to COM1 (pins D0 and D1).  However, I am using NeonMika Webserver in my project to host a web interface.  When in this project, my SerialPort will not open.  Here's the code below. Thanks! 

using System;
using System.Net;
using System.Net.Sockets;
using System.Collections;
using System.Threading;
using System.IO.Ports;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using NeonMika.Webserver;
using NeonMika.Webserver.Responses;

namespace HomeAutomation
{
    public class Program
    {
        public static SerialPort serial = new SerialPort(SerialPorts.COM1, 9600);

        public static void Main()
        {
            serial.Open(); // error is thrown here and breaks the program

            Server server = new Server(PinManagement.OnboardLED, 80, false, "192.168.1.120", "255.255.255.0", "192.168.1.1", "netduinoplus");
            //server.AddResponse(new XMLResponse("send", new XMLResponseMethod(Program.Send)));
        }


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 02 May 2014 - 10:45 PM

Hi zimmersm,

Two things:
1. Are pins D0 and D1 being used anywhere in the libraries?
2. Try moving the "= new SerialPort" code to your main class. The order of instantiation in NETMF is a little different than in other flavors of .NET.

Welcome to the Netduino community,

Chris

#3 Jack Chidley

Jack Chidley

    Advanced Member

  • Members
  • PipPipPip
  • 99 posts

Posted 03 May 2014 - 02:56 PM

Chris, is this instantiation order documented somewhere? I recall another post about networking where there were differences from other .net implementations too.

Jack





Also tagged with one or more of these keywords: serial, netduino 2 plus, netduino, com port

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.