This project has moved. For the latest updates, please go here.

Having trouble with the Xbee libraries

Jun 5, 2009 at 9:47 PM

Hello,

I have been messing with the XBee library here, and as a beginner to all this, I have some questions.

I have been reading ZigBee and XBee documentation to the point of making my head explode, and am happy to say that I am starting to get the hang of it all.  But I of course need just a little help.  But first some background on what i am doing:

I am in the process of writing an app for the coordinator.  At this point, my app will find all the nodes in my PAN (currently two - the coordinator, and my test device), and populate a list.  If i want to send some data (like the word "hello") from the corrdinator to an end device, I type it in a text box, highlight the serial number i want to send to, and click send. That is where I run in to problems.  I can't seem to get any data out to the other radio.  I am running a COM port sniffer app on both XB modules, and I can see the data going out the coordinator side, but of nothing is received from the end-device.   I am sure I am doing something wrong, but can't figure out what it is.  I am trying things from the ZigBee Console app that look right, and am scouring your source code to try and figure it out, but i have had no luck so far.  So I am hoping for a little help.  here's the code snippet i am using to send:

 

XBeeAddress64 serialNumber = new XBeeAddress64(ulong.Parse(deviceListListView.SelectedItems[0].Text));
XBeeAddress16 shortAddress = new XBeeAddress16(ushort.Parse(deviceListListView.SelectedItems[0].SubItems[1].Text));
ZigBeeTransmitRequest x = new ZigBeeTransmitRequest(serialNumber, shortAddress, Encoding.ASCII.GetBytes(messageTextBox.Text));
try
{

xbee.Execute(x);
}
catch (Exception ex)
{
LogIt("Exception Thrown: " + ex.Message);
}

 

Of course the exception is thrown because it's not going anywhere.  Is there something I need to do before sending anything, or is there a setting on the XB modules I am missing? I am at a loss.  Please forgive my ignorance, but of all the things i have tried, i have failed every time, which is why i am asking here.  

It should be noted that if i set the destination addresses in X-CTU on the modules to point to eachother, i can send back and forth in the console there, and it works fine.  For a more comprehensive view of everything, I have zipped everything up and placed it here (http://www.paranoidgnome.com/XBeeExampleCode.zip) for anyone to view and make suggestions. I also included in the archive the X-CTU profile settings of both xbee modules. (coordinator.pro and device.pro)

 Hopefully I am not too far off in my little proof of concept, and hopefully someone can point me in the right direction.  Thank you in advance,

 

-Brandon

 

Coordinator
Jun 5, 2009 at 10:57 PM

Hi Brandon,

I will have a look on this configuration on Monday, I'm currently on a business trip.

Michael

Jun 6, 2009 at 7:12 AM

Michael,

Thank you for your quick reply.  I just wanted to let you know that i have made some discoveries since my last post, and am able to send text to the remote XB module.  I did have to make several changes to your code to make this work.  Looking through the XBee documentation, it looks like the API command header was incorrect, among other things.  I don't know if we are looking at different versions of the documentation or what, but there seems to be some differences between what I see in the docs, and what is in the code.   The doc file I am reading is the one i downloaded from: http://ftp1.digi.com/support/documentation/90000982_A.pdf  

Tomorrow I will upload my proof of concept program (it's late, and I am tired) which will show any changes to your code i made to get this to work.  Hopefully this information will be helpful to you. Anything that I did in the code that you find useful, feel free to use it in future releases if you like.

Again, thank you for all the work you have put in to this. I am very impressed.

-Brandon

Coordinator
Jun 6, 2009 at 7:55 AM

Hi,

well, I think I used the documentation http://ftp1.digi.com/support/documentation/90000866_C.pdf. I will compare the command sets. If you have done some changes feel free to send it diretly as a ZIP file to my mail address.

Michael

Jun 6, 2009 at 10:48 PM

Wow, no wonder i have been struggling so much with this! It looks like we are using different modules. Comparing the two command sets, they are indeed different. I didn't realize they would be that different between the two versions (i'm a beginner, remember).  

Well, I guess all my changes were just to get it working with my command set, which isn't all bad.  I don't know if you have any plans for supporting anything other than what you have implemented, but I will attach my changes as promised.   I will just replace the old link with the new code.  

Any changes I made to your code I made sure to comment any changes.  You can search for "// Brandon" in the entire solution, and it should show you anything I changed.  Maybe it will be useful for you, maybe not. 

I think I will continue to make these small changes, so I can move forward with my little project, but if you are interested in anything I change, let me know, and I will make sure I keep you in the loop.  I don't want to duplicate any work others are doing, but I don't mind helping out either. 

My demo project is still located at 
http://www.paranoidgnome.com/XBeeExampleCode.zip 

Thanks again,

Brandon

Coordinator
Jun 7, 2009 at 7:03 AM

I will add some code to support both modules which should not be a big problem...

Michael

Coordinator
Jun 10, 2009 at 9:52 PM

I'm currently adding your code to support series 1 modules, too. Please give me some more hours to get it working.

Thank you for your feedback!!

Regards,
Michael

Jun 10, 2009 at 9:54 PM

Awesome!  If you would like me to test anything, please let me know.  Anything I can do to help!

-Brandon

Coordinator
Jun 10, 2009 at 10:00 PM

Yes, of course, if I have a first version available I let you know. Maybe you could send me a short mail that I have you mail address to send you a first copy of my sources.

Michael