I've had quite a few people getting in contact asking for support with the initial setup and configuration of libxbee. As a result, I felt that it would be worthwhile writing this guide. libxbee is very straight forward, once you understand the principals involved.
libxbee has not been developed for use on bare metal systems. Arduino and PIC are bare metal systems.
libxbee supports the most popular operating systems - Linux, Windows, FreeBSD and now OS X too! My operating system of choice is Linux, meaning that it will likely be the most stable and best supported. At the opposite end of the spectrum is OS X, which without the generosity of the community, I have no access to.
The C++ interface library is not currently supported under OS X.
First of all you should ensure that you have the required tools to build the library. The following list contains the bare minimum.
Next, you'll need to get a copy of the source code. Please see this page for more information on how to get the source code.
Now that you have the source code, you can proceed with compiling libxbee. This happens in a few steps, but should generally be a painless operation.
make configure. If this completes successfully, then you should see that a file (
config.mk) has appeared in the base directory.
config.mk. If you are cross-compiling, would like to strip the library down to the mode(s) that you want to use, or would like to enable more debugging information, then this is where you should do it.
MODELISTvariable will determine which modes are built into the library. If you leave it commented, then the default list containing all of the modes will be used.
CROSS_COMPILEvariable should be set to your toolchain's prefix (see
make/default/arm920t.mkfor an example cross-compile configuration).
maketo build the library. This should complete without any issues.
make installwith any required priviledge escalation (e.g:
When you run libxbee, you'll need to increase the number of files that a single process can have open at one time.
This is due to a limitation of the implementation of semaphores on OS X.
To do this, you should run the following command before running your application (or before calling
xbee_setup() by using
system() or equivelant).
ulimit -n 1024
It is also worth mentioning the funky UART file descriptors that OS X has...
Where on Linux you'd use
/dev/ttyUSB0, on OS X you'd expect to use
In fact, you should use
This only makes sense if you know this, and had me chasing my tail for hours...