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.

Cinelli

Member Since 08 May 2011
Offline Last Active Jul 07 2012 01:19 AM
-----

Topics I've Started

Need Quality RS485 Shield or Pull up pull down from code

05 July 2012 - 08:12 PM

I have been using a common RS485 Shield:
http://www.robotshop...n-33&lang=en-US

I found that while it has the Maxim MAX485 chip it lacks the accompanying resistors to perform to RS485 spec due to the lack of "biasing resistors for failsafe operation" which zero out the RS485 bus to a constant state when the bus is idle. These resistors are either integrated in some transceiver models, or placed on the board. This has neither. The result is the data transferred is corrupted across longer lengths of wire. Using an appropriate 33 ohm terminating resistor adds some stability, but cannot make up for the lack of biasing resistors.

Maxim has a great short description which outlines the RS485 spec.
http://www.maxim-ic....ndex.mvp/id/763

Solutions:
1. Use a better shield. The only other RS485 shield I see is the DFRobot IO/Expansion V5. I have never been able to make the RS485 on that work. Perhaps the .Net MF COM1/COM2 objects are not wired to the pins the transciever is using, haven't dug into that.
http://www.dfrobot.c...&product_id=264

2. Replace the chip on the board with the Maxim MAX13487 which has some biasing resistors built in.

3. Use a code-based solution to pull the pins on the board high and low depending on send/receive status. This might not work though, as they are upstream from the RS485 Transceiver which probably is passing corrupted data toward the processor at that point.

Finding a shield with the resistors is an attractive option.

I tried all combinations of the COM object handshake property with no success.

Suggestions / ideas?

Thanks in advance

Netduino XBee Serial Settings: DIO7 & DIO6

16 August 2011 - 08:55 PM

Hi - Working with XBee and RS485, successful sending data between radios, so they're paired. But if I try to send data through a shield instead of Digi's RS485 Adapter it doesn't work. So, it works if I talk through Digi's XBee RS-485 adapters at both ends but not with one Adapter at the (End Device/Router) <--> Shield at the Netduino (Coordinator).

Target configuration is:
Netduino
XBee Shield
XBEE COORDINATOR RADIO(XBP24BZ7, firmware 208C)

- talks to -

XBEE ROUTER RADIO
Digi XBee 485 Adapter ZB PRO S2B
RS485 Device

Using Digi XCTU for radio config, I suspect that the Netduino's XBee (Shield Radio, Coordinator) needs DIO7 & DIO6 set to "Digital Input" to tell it to expect to talk through the Digital Pins 0 & 1, rather than "RS485 Enable HIGH" (or LOW) as works when going through the RS485 transceiver.

Any insights anyone? Thanks in advance.

No Exception on lost Ethernet connection

09 August 2011 - 05:48 AM

This code works fine while Ethernet is plugged in. It also properly throws exceptions and retries if you start with Ethernet disconnected. If you plug in after some failures it also restarts correctly. The problem comes if you boot with Ethernet connected, let it run for 1 or more loops, then disconnect (or lose) Ethernet. In this last case GetRequestStream neither returns nor throws an exception: the device locks up.

Any insights? Thanks in advance.

[size="4"]
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using Microsoft.SPOT;

namespace M2W.NetduinoReader
{
    class WebTest
    {
        public static void Main()
        {
            for(int i = 0; i < 20; i++)
            {
                Thread.Sleep(3000);

                using(HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(@"http://www.google.com"))
                {
                    request.Timeout = 15000;
                    request.ReadWriteTimeout = 5000;
                    request.Method = "POST";
                    request.ContentType = "application/x-www-form-urlencoded";
                    byte[] bytes = Encoding.UTF8.GetBytes("a=3&b=4");
                    request.ContentLength = bytes.Length;
                    Debug.Print("request.GetRequestStream");
                    try
                    {
                        using(Stream requestStream = request.GetRequestStream())
                        {
                            requestStream.Write(bytes, 0, bytes.Length);
                            requestStream.Close();
                        }
                    }
                    catch(WebException ex)
                    {
                        Debug.Print("WebException on GetRequestStream: " + ex.Message);
                        continue;
                    }
                    catch(Exception ex)
                    {
                        Debug.Print("Exception on GetRequestStream: " + ex.Message);
                        continue;
                    }

                    Debug.Print("request.GetResponse");
                    try
                    {
                        using(HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                        {
                            int respSize = System.Math.Min((int)response.ContentLength, 80);
                            if(respSize != 0)
                            {
                                byte[] respData = new byte[respSize];
                                try
                                {
                                    Debug.Print("request.GetResponseStream");
                                    using(Stream responseStream = response.GetResponseStream())
                                    {
                                        responseStream.Read(respData, 0, respData.Length);
                                        responseStream.Close();
                                    }
                                    string responseString = new string(Encoding.UTF8.GetChars(respData));
                                    Debug.Print("Response was: " + responseString);
                                }
                                catch(WebException ex)
                                {
                                    Debug.Print("WebException on GetResponseStream: " + ex.Message);
                                }
                                catch(Exception ex)
                                {
                                    Debug.Print("Exception on GetResponseStream: " + ex.Message);
                                }
                            }
                            else
                            {
                                Debug.Print("Response was empty");
                            }
                            response.Close();
                        }
                    }
                    catch(WebException ex)
                    {
                        Debug.Print("WebException on GetResponse: " + ex.Message);
                    }
                    catch(Exception ex)
                    {
                        Debug.Print("Exception on GetResponse: " + ex.Message);
                    }
                }
            }
        }
    }
}
[/size]

DFRobot I/O Expansion Shield V5 XBee tips?

21 July 2011 - 11:12 PM

Having issues with the DFRobot I/O Expansion Shield V5 with RS485 & XBee. (pic attached, link below). Question 1: Does anyone have experience with this or with it and Netduino? Our results have been mixed. To interface with the XBee, we are using Serial.COM1 and it doesn't appear to be getting through. The RS485 is also not working, whereas we have other styles of RS485 shields which work fine. It's not clear what you jump on this, that's not documented though there is a Wiki on the product page with some info at the link below. http://www.dfrobot.c...&product_id=264 Question 2: Has anyone found there to be advantages in setting the XBee baud rate, stop bits and flow control to match the serial communication baud rate etc? Thanks in advance

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.