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

Can't read config

Jul 18, 2012 at 7:18 PM
Edited Jul 18, 2012 at 7:21 PM

I bought 2 XBee Adapter Modules and 2 XBee 2 series modules. 
I first tried to use the standard classes I get from gadgeteer to make a connection between my Cerberus and Hydra boards but that failed so I found this promosing library.

The problem that I'm now having is when I call the configure method it fails. After some debugging I found the part where it fails:

When setting up the Config property it fails getting the first property of the config. The ApiMode property. It has a problem with reading from the localXbee object, which gives an XBeeTimeoutException.

My code is pretty straight forward I guess:

_xBee = new GTM.OpenSource.XBee(2);
_xBee.Configure();
_xBee.Api.StatusChanged += new NETMF.OpenSource.XBee.XBeeApi.XBeeModemStatusEventHandler(Api_StatusChanged);
_xBee.Api.DataReceived += new NETMF.OpenSource.XBee.XBeeApi.XBeeDataReceivedEventHandler(Api_DataReceived);

That's all I do.

I find it weird that noone else has problems with this.

I just try to use the library as simple as possible and the first thing I get is this.

Kind regards and thanks in advance. 

Coordinator
Jul 19, 2012 at 7:14 AM

Hi,

First of all are you able to communicate with your module using X-CTU app? If not I suggest you buy a USB adapter for your XBee, like this:

http://www.sparkfun.com/products/8687

Of course you can make one yourself or find a cheaper one. The point is - using this adapter you will be able to upgrade/change firmware in your XBee and set up its configuration. When using XBee Series 2 it is required that the modules are running API firmware because the driver uses API frames to communicate (oposite to using AT commands). Let me know if this fixes your issue.

Jul 23, 2012 at 3:51 PM

Thanks, I ordered one, once I received it and tried out what you said I will come back to this thread.

Jul 29, 2012 at 12:44 PM
Edited Jul 29, 2012 at 2:07 PM

So I received the XBee Explorer and I've chosen the XBee Router API config to write to my 2 XBee's.

So when I run my code now I don't get the exception anymore I got before. 
I can also read the config now and it's correct.

But still when I do _xbee.Api.Send("some string") on the one xbee I don't receive anything on the other one.

I don't really know what I'm doing wrong. I tried to discover nodes but that returns an empty ArrayList.

Any obvious thing I can do?
Is there maybe a walkthrough to make two xbees talk in a simple way with 2 mainboards or so? 

*Edit*

I now set the config of the receiving end as End Device API and the other end as Router API and I notice the router never fires the OnStatusChanged event where in the demo the discover nodes is fired. Or is it the Coordinater that fires that event? Because I only have 2 XBee's and I assume it can be done with only 2?

Coordinator
Jul 30, 2012 at 1:17 PM

Configure one of your XBee as coordinator and the other one as router. Your XBee need to join the same network before able to communicate. You can assosiate two routers without a coordinator but that requires setting static network values via X-CTU. When you have a coordinator, the router will join its network and you will be able to communicate between those two. The OnStatuChanged event will be triggered on router side when it will join the network. 

Jul 31, 2012 at 12:34 PM

Thanks, it worked.

If I find the time I'll make a walk through or tutorial for this.