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.

Kenny Kerr

Member Since 29 Dec 2010
Offline Last Active Jan 29 2014 06:50 PM
-----

Topics I've Started

RS485 between two Netduinos

24 January 2011 - 06:00 PM

Hi there,

I have a Netduino and a Netduino Plus that I’ve connected to RS485 transceivers in an attempt to test serial communication between the two. My wiring may well be wrong but I’m just trying to eliminate coding errors first.

The tranceiver requires 3 pins which map to RX, TX and RTS on the netduino I believe. I have connected these to digital pins 2, 3 and 7. I assume this maps to COM2.

The netduino plus attempts to send a few bytes when the button is pressed:

class Program
{
    static SerialPort m_port;

    static void Main()
    {
        m_port = new SerialPort("COM2", 9600, Parity.None, 8, StopBits.One);
        m_port.Handshake = Handshake.RequestToSend;
        m_port.DataReceived += OnDataReceived;
        m_port.ErrorReceived += ErrorReceived;
        m_port.Open();

        InterruptPort button = new InterruptPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);
        button.OnInterrupt += OnButton;

        Thread.Sleep(Timeout.Infinite);
    }

    static void ErrorReceived(object sender, SerialErrorReceivedEventArgs args)
    {
        Debug.Print("error");
    }

    static void OnDataReceived(object sender, SerialDataReceivedEventArgs args)
    {
        Debug.Print("data");
    }

    static void OnButton(uint data1, uint data2, DateTime time)
    {
        if (0 == data2)
        {
            var bytes = Encoding.UTF8.GetBytes("hello from netduino plus");
            int count = m_port.Write(bytes, 0, bytes.Length);
            Debug.Assert(bytes.Length == count);
            m_port.Flush();
        }
    }
}

The netduino on the other end simply waits to receive data:

class Program
{
    static SerialPort m_port;

    static void Main()
    {
        m_port = new SerialPort("COM2", 9600, Parity.None, 8, StopBits.One);
        m_port.Handshake = Handshake.RequestToSend;
        m_port.DataReceived += OnDataReceived;
        m_port.ErrorReceived += ErrorReceived;
        m_port.Open();

        Thread.Sleep(Timeout.Infinite);
    }

    static void ErrorReceived(object sender, SerialErrorReceivedEventArgs args)
    {
        Debug.Print("error");
    }

    static void OnDataReceived(object sender, SerialDataReceivedEventArgs args)
    {
        Debug.Print("data");
    }
}

Although the SerialPort.Write call succeeds, data is never received on the remote SerialPort. Am I doing something obviously wrong?

Cheers,
Kenny

Using netduino plus without .NET

14 January 2011 - 03:10 PM

I’m doing a lot of UDP networking and am not too pleased with the performance of the interpreter (encoding, decoding packets etc). On the desktop I’m using C++ and am wondering whether I can use the netduino boards I have to prototype some completely native firmware. In particular I was thinking of using uIP or lwIP. I’m not sure which one so I’ll probably just try them both and see what the pros and cons are. Is netduino suited for this type of development? Also if there are any suggestions for tooling I’d appreciate it. I’m new to microcontroller development but have used C++ on the desktop for years. Should I write to the metal or use some kind of mini OS? What about drivers for the network adapter and SD card? I’ll probably just try and figure out what the Micro Framework is doing under the covers but any suggestions would be appreciated. At the very least I want to prototype a native UDP implementation to compare the performance against the Micro Framework’s Socket implementation written in C#.

C++ compilers

05 January 2011 - 03:04 PM

Hi Chris, If we decided to throw some native code into the mix what C++ compilers are available? On the desktop I use Visual C++ 2010 with its good support for C++0x language features and libraries. Presumably the Standard C++ Library won’t be available but at least a compiler with good support for templates is a must. Also, is it pretty straightforward to mix some native functions into an otherwise C# based Netduino project? My Netduino Plus has finally shipped. Can’t wait! Cheers, Kenny

Big-endian

02 January 2011 - 12:29 AM

Hi Chris, Do you know whether it’s possible to switch the netduino to big-endian? I’m doing a boatload of network I/O and it would save a lot of effort in the firmware if it were big-endian rather than little-endian. I know the ARM processors support switching this and the Micro Framework obviously supports both modes. I’m just not sure how to switch it on the Atmel microprocessor. My only concern is that the Atmel’s memory controller may only support little-endian. Cheers, Kenny

Schematic files

29 December 2010 - 01:48 AM

Hi Chris, I’ve ordered a few netduino boards. It’s working great as a development board for a project we’re working on. I heard in an interview that netduino is an “open source” project. I was hoping to get the schematic files so that we can use them as a starting point for our project hardware. We need to add a bunch of comm ports, RAM, etc. and it would save us a lot of time. I see the .brd files are available online but it would be great if we could get the .sch file for the netduino plus for use in CadSoft Eagle. Cheers, Kenny

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.