XBee Troubleshooting Ideas?
#1
Posted 26 August 2010 - 02:26 PM
#2
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
Posted 26 August 2010 - 05:32 PM
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.After that I put it into a loop where it just writes and flushes "Hello world" every 5 seconds.
Can you show the code that you are using?
I'm not having any problem communicating both ways (using a custom XBee shield).
#4
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
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
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
Posted 26 August 2010 - 11:57 PM
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
Posted 30 August 2010 - 01:01 PM
If the XBee sends and receives data, I can't see how the soldering is an issue. Did you solder something to com1?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?
I'd guess that something else on your computer is tying up Com1. Do you have any blue tooth devices or software running?
#9
Posted 13 November 2010 - 01:39 AM
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.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?
#10
Posted 26 November 2010 - 02:44 PM
tony
#11
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
Posted 27 November 2010 - 10:00 AM
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?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
tony
#13
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
Posted 26 December 2010 - 07:23 PM
#15
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
Posted 27 December 2010 - 01:49 PM
Attached Files
#17
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.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users