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

XBee Troubleshooting Ideas?


  • Please log in to reply
16 replies to this topic

#1 amphibian

amphibian

    Member

  • Members
  • PipPip
  • 16 posts

Posted 26 August 2010 - 02:26 PM

I just got the sparkfun xbee wireless kit and got it all soldered up and plugged in. I plugged in the xbee explorer to the PC, installed the x-ctu software from digi. I initialize the serial port in my application to 9600 speed, 8 bits, no parity, 1 stop bit , open the port, and wire up the DataReceived event. After that I put it into a loop where it just writes and flushes "Hello world" every 5 seconds. If i open the x-ctu terminal on my PC and type, it I can see the lights blinking on the xbee's, and the DataReceived event fires on the netduino, and a call to read returns my bytes. The problem i'm having is that "Hello world" isn't coming out on the PC end of things. I've tried flushing etc, but nothing. Could I possibly have a loose solder joint on the tx pin for the xbee shield? What's the best way to go about troubleshooting?

#2 greg

greg

    Advanced Member

  • Members
  • PipPipPip
  • 169 posts
  • LocationChicago, IL

Posted 26 August 2010 - 03:14 PM

I just got the sparkfun xbee wireless kit and got it all soldered up and plugged in. I plugged in the xbee explorer to the PC, installed the x-ctu software from digi.

I initialize the serial port in my application to 9600 speed, 8 bits, no parity, 1 stop bit , open the port, and wire up the DataReceived event.
After that I put it into a loop where it just writes and flushes "Hello world" every 5 seconds.

If i open the x-ctu terminal on my PC and type, it I can see the lights blinking on the xbee's, and the DataReceived event fires on the netduino, and a call to read returns my bytes.

The problem i'm having is that "Hello world" isn't coming out on the PC end of things. I've tried flushing etc, but nothing.

Could I possibly have a loose solder joint on the tx pin for the xbee shield? What's the best way to go about troubleshooting?


This is going to sound silly, but make sure the PAN ID is the same on both modules. The default is 3332 (I actually change mine on all my XBee's). Also check under "Serial Interfacing" that both modules are set to the same baud rate.

Another (stupid) mistake I made once was having the TX on the xbee going to TX on the netduino. Woops. Make sure you've got it TX->RX and RX->TX properly.

It should be fire and forget - I've got mine humming away right now in fact - but just something you may need to double-check. X-CTU is your friend.

#3 PaulS

PaulS

    New Member

  • Members
  • Pip
  • 7 posts

Posted 26 August 2010 - 05:32 PM

After that I put it into a loop where it just writes and flushes "Hello world" every 5 seconds.

If data is getting from the XBee to the Netduino, there's only a very small chance that data is not getting from the Netduino to the XBee because of a hardware problem.

Can you show the code that you are using?

I'm not having any problem communicating both ways (using a custom XBee shield).

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 August 2010 - 06:14 PM

I just got the sparkfun xbee wireless kit and got it all soldered up and plugged in. I plugged in the xbee explorer to the PC, installed the x-ctu software from digi.

I initialize the serial port in my application to 9600 speed, 8 bits, no parity, 1 stop bit , open the port, and wire up the DataReceived event.
After that I put it into a loop where it just writes and flushes "Hello world" every 5 seconds.

If i open the x-ctu terminal on my PC and type, it I can see the lights blinking on the xbee's, and the DataReceived event fires on the netduino, and a call to read returns my bytes.

The problem i'm having is that "Hello world" isn't coming out on the PC end of things. I've tried flushing etc, but nothing.

Could I possibly have a loose solder joint on the tx pin for the xbee shield? What's the best way to go about troubleshooting?


amphibian,

Are you using an XBee shield which "steps down" the voltage from 5V to 3.3V for the XBee module? If so, does it do a true 3.3V conversion--or is it just cutting the voltage? It's possible that the Netduino is getting 5V signals FROM the XBee module but that the accessory board is cutting the voltage on 3.3V signals coming from the Netduino.

If you can let us know which XBee hardware you're using (module and inteface/shield), that would be really helpful. We're making a list of compatible accessories...and it would be great to show which boards are designed to work with 3.3V signals...

Chris

#5 greg

greg

    Advanced Member

  • Members
  • PipPipPip
  • 169 posts
  • LocationChicago, IL

Posted 26 August 2010 - 06:28 PM

amphibian,

Are you using an XBee shield which "steps down" the voltage from 5V to 3.3V for the XBee module? If so, does it do a true 3.3V conversion--or is it just cutting the voltage? It's possible that the Netduino is getting 5V signals FROM the XBee module but that the accessory board is cutting the voltage on 3.3V signals coming from the Netduino.

If you can let us know which XBee hardware you're using (module and inteface/shield), that would be really helpful. We're making a list of compatible accessories...and it would be great to show which boards are designed to work with 3.3V signals...

Chris


Chris,

The http://www.ladyada.net/make/xbee/ XBee adapter works like a charm. It's what I'm using.

#6 amphibian

amphibian

    Member

  • Members
  • PipPip
  • 16 posts

Posted 26 August 2010 - 06:35 PM

Are you using an XBee shield which "steps down" the voltage from 5V to 3.3V for the XBee module? If so, does it do a true 3.3V conversion--or is it just cutting the voltage? It's possible that the Netduino is getting 5V signals FROM the XBee module but that the accessory board is cutting the voltage on 3.3V signals coming from the Netduino.

If you can let us know which XBee hardware you're using (module and inteface/shield), that would be really helpful. We're making a list of compatible accessories...and it would be great to show which boards are designed to work with 3.3V signals...


Sorry, I meant to include the link on my first post (I even had it in the clipboard).
This is the kit for the xbee I'm using

http://www.sparkfun....roducts_id=9897

If data is getting from the XBee to the Netduino, there's only a very small chance that data is not getting from the Netduino to the XBee because of a hardware problem.


That's kind of what I thought. It seemed weird to me that it was working 1 way but not the other. I was going to give this lib a try thinking maybe I was missing something with the serial port commands, but it sounds like it ought to be working.

I will post my code when I get home tonight, although it's pretty trivial.

#7 amphibian

amphibian

    Member

  • Members
  • PipPip
  • 16 posts

Posted 26 August 2010 - 11:57 PM

Ok I feel dumb now. I changed it over to Com2 and it works fine. It seems like maybe I messed up on some soldering then?

Here's the code I was using anyway (even though I got it working)

public static void Main()
    	{
        	SerialPort xbee = new SerialPort(SerialPorts.COM2,9600,Parity.None,8,StopBits.One);
        	xbee.Open();
        	xbee.DataReceived += new SerialDataReceivedEventHandler(XBeeDataReceived);

        	while (true)
        	{
            	string output = "Hello " + DateTime.Now.Ticks;
            	byte[] bytes = System.Text.Encoding.UTF8.GetBytes(output);
            	xbee.Write(bytes, 0, bytes.Length);
            	xbee.Flush();
            	Thread.Sleep(5000);
        	}

    	}

    	static void XBeeDataReceived(object sender, SerialDataReceivedEventArgs e)
    	{
        	int bytesReceived = ((SerialPort)sender).BytesToRead;
        	byte[] bytes = new byte[bytesReceived];
        	((SerialPort)sender).Read(bytes, 0, bytes.Length);
        	string received = new string(System.Text.Encoding.UTF8.GetChars(bytes));
        	Debug.Print(received);
    	}


#8 PaulS

PaulS

    New Member

  • Members
  • Pip
  • 7 posts

Posted 30 August 2010 - 01:01 PM

Ok I feel dumb now. I changed it over to Com2 and it works fine. It seems like maybe I messed up on some soldering then?

If the XBee sends and receives data, I can't see how the soldering is an issue. Did you solder something to com1? :huh:
I'd guess that something else on your computer is tying up Com1. Do you have any blue tooth devices or software running?

#9 GDSever

GDSever

    Advanced Member

  • Members
  • PipPipPip
  • 81 posts
  • LocationNewark, DE

Posted 13 November 2010 - 01:39 AM

Ok I feel dumb now. I changed it over to Com2 and it works fine. It seems like maybe I messed up on some soldering then?

Not to dig up a way-old post, but I was using the same SparkFun Xbee shield and ran into this issue as well. After a little playing around, I found it is the small switch on the shield that impacts whether it uses COM2 or COM1. If you have the switch in the UART position, it will come out on COM1. The other position and it will go to COM2.

#10 mrxer

mrxer

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationAustralia

Posted 26 November 2010 - 02:44 PM

using the code above to read data from the xbee but get an error of ...An unhandled exception of type 'System.Exception' occurred in mscorlib.dll on this line.... string received = new string(System.Text.Encoding.UTF8.GetChars(bytes)); 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\mscorlib.dll', Symbols loaded. 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Native.dll', Symbols loaded. 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Hardware.dll', Symbols loaded. 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.dll', Symbols loaded. 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.IO.dll', Symbols loaded. 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\System.IO.dll', Symbols loaded. 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Assemblies\le\Microsoft.SPOT.Hardware.Usb.dll', Symbols loaded. 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Secret Labs\Netduino SDK\Assemblies\v4.1\le\SecretLabs.NETMF.Hardware.dll', Symbols loaded. 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Secret Labs\Netduino SDK\Assemblies\v4.1\le\SecretLabs.NETMF.Hardware.Netduino.dll', Symbols loaded. 'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'Q:\Data\netduino\NetduinoApplication1\NetduinoApplication1\bin\Debug\le\NetduinoApplication1.exe', Symbols loaded. The thread '<No Name>' (0x2) has exited with code 0 (0x0). #### Exception System.Exception - CLR_E_WRONG_TYPE (3) #### #### Message: #### System.Text.UTF8Encoding::GetChars [IP: 0000] #### #### NetduinoApplication1.Program::XBeeDataReceived [IP: 0025] #### #### System.IO.Ports.SerialPort::DataEventHandler [IP: 0012] #### A first chance exception of type 'System.Exception' occurred in mscorlib.dll An unhandled exception of type 'System.Exception' occurred in mscorlib.dll

tony


#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 November 2010 - 04:40 PM

using the code above to read data from the xbee but get an error of ...An unhandled exception of type 'System.Exception' occurred in mscorlib.dll

on this line....

string received = new string(System.Text.Encoding.UTF8.GetChars(bytes));


Hi mrxer,

That may be a UTF8 encoding issue. Is the data you're trying to read ASCII (7-bit) Do you know what text/data the exception is dealing with?

Chris

#12 mrxer

mrxer

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts
  • LocationAustralia

Posted 27 November 2010 - 10:00 AM

Hi mrxer,

That may be a UTF8 encoding issue. Is the data you're trying to read ASCII (7-bit) Do you know what text/data the exception is dealing with?

Chris

Your right..think it has something to do with the characters. Question...i assume i can write to the XBEE while the netduino is connected tho the computer? Is the USB connector connected to the same pins as the XBee on the Xbee explorer?

tony


#13 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 27 November 2010 - 06:04 PM

Your right..think it has something to do with the characters. Question...i assume i can write to the XBEE while the netduino is connected tho the computer? Is the USB connector connected to the same pins as the XBee on the Xbee explorer?


You can absolutely write to the XBEE while the Netduino is connected to the computer. The USB port is a dedicated port. Both COM1 (D0/D1) and COM2 (D2/D3) are independent ports.

Chris

#14 XavGG

XavGG

    New Member

  • Members
  • Pip
  • 9 posts

Posted 26 December 2010 - 07:23 PM

Hello, I'm trying to communicate netduino to my laptop using xBee. I already have the transmitter tested and it works fine. The problem comes when I replace arduino receiver for the netduino. I’m using the arduino xBee shield and I realize that netduino doesn’t have the six pins that arduino has soldered. I think this is the problem because xBee looks unpowered. Did some of you use this shield? Do you know if I have to solder this pins or power it from other pins? If they are not compatible can I connect it directly with the serial and vcc ports (only if there isn’t other way) ? I have two classes using both libraries (Grommet & Michael) ready to test the communication. But when I try to open API module exception is shown. Thanks people! (I dubt to put this post here or in this other post http://forums.netdui...ting-with-xbee/)

#15 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 December 2010 - 08:16 PM

I think this is the problem because xBee looks unpowered. Did some of you use this shield? Do you know if I have to solder this pins or power it from other pins?


Hi XavGG,

I believe that the XBEE shield draws power from the 5V header on the optional "ICSP" connector. If you solder one on, you should be fine. You could also connect a jumper wire between the 5V header on the Netduino and the 5V ICSP header on the XBEE shield. Or use another brand of XBEE shield. We're happy to walk you through any of these options.

The 6-pin ICSP header is only required for a few shields (Arduino Ethernet shield, Arduino XBee shield, etc.)--but we made sure that we put the pins there just in case you needed them.

A number of vendors sell the 6-pin headers for less than a dollar. Here's one that we've tested (note: DigiKey's photo shows only half of the connector):
http://search.digike...ds=67996-206HLF

Chris

#16 XavGG

XavGG

    New Member

  • Members
  • Pip
  • 9 posts

Posted 27 December 2010 - 01:49 PM

Thanks! I soldered them now but is showing the same exception again. With Grommet library first tells that a problem occurred with hardware, please check it says. But at the end both libraries finish with the exception I attach. Now the shield is correctly powered and looks like when is connected to arduino. The code near the exception is all my xbee class code; maybe you can find a mistake. Thanks again for your help.

Attached Files



#17 XavGG

XavGG

    New Member

  • Members
  • Pip
  • 9 posts

Posted 27 December 2010 - 02:02 PM

Thanks!
I soldered them now but is showing the same exception again. With Grommet library first tells that a problem occurred with hardware, please check it says. But at the end both libraries finish with the exception I attach. Now the shield is correctly powered and looks like when is connected to arduino.
The code near the exception is all my xbee class code; maybe you can find a mistake.
Thanks again for your help.


Sorry but I tried to not use any library and use my serial communication class and looks it works fine, I only have a problem with parsing bytes to string, and I think the problem comes from the transmitter because is an arduino and not a PC serial com.

So my question is why there’re two libraries for xBee? What are they for?
Thanks.




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.