xbee-arduino and Arduino DUE

1,045 views
Skip to first unread message

Matt

unread,
Feb 4, 2013, 6:50:26 AM2/4/13
to xbee...@googlegroups.com
Hi Andrew, hi all,

I recently tried to use the xbee-arduino api with my brand new Arduino Due. The Arduino DUE uses a different compiler due to the new 32Bit platform (ARM ATSAM3X8E). Unfortunatly but maybe also expectably compiling my project failed ;-)
Here is what the compiler says:

C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:151: error: expected constructor, destructor, or type conversion before 'class'
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:322: error: expected class-name before '{' token
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:333: error: expected class-name before '{' token
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:529: error: expected class-name before '{' token
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:705: error: 'XBeeResponse' has not been declared
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:710: error: ISO C++ forbids declaration of 'XBeeResponse' with no type
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:710: error: expected ';' before '&' token
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:731: error: 'XBeeResponse' does not name a type
KoordinatorPager.ino: In function 'void checkIncomingXBeePackets()':
KoordinatorPager:2094: error: no matching function for call to 'XBee::getResponse()'
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:705: note: candidates are: void XBee::getResponse(int&)
KoordinatorPager:2102: error: no matching function for call to 'XBee::getResponse()'
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:705: note: candidates are: void XBee::getResponse(int&)
KoordinatorPager:2105: error: no matching function for call to 'XBee::getResponse()'
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:705: note: candidates are: void XBee::getResponse(int&)
KoordinatorPager:2107: error: no matching function for call to 'XBee::getResponse()'
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:705: note: candidates are: void XBee::getResponse(int&)
KoordinatorPager:2116: error: no matching function for call to 'XBee::getResponse()'
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:705: note: candidates are: void XBee::getResponse(int&)
KoordinatorPager:2125: error: no matching function for call to 'XBee::getResponse()'
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:705: note: candidates are: void XBee::getResponse(int&)
KoordinatorPager:2126: error: no matching function for call to 'XBee::getResponse()'
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.h:705: note: candidates are: void XBee::getResponse(int&)

I guess these are just syntactic problems due to the different compilers. Has anybody tried to use the xbee-arduino library with the new Arduino Due toolchain? I am not so into C/C++, so who wants to help with porting adrews code?

Cheers,

Matt
Message has been deleted

Matt

unread,
Feb 4, 2013, 8:53:09 AM2/4/13
to xbee...@googlegroups.com
Dear me, dear all, :-D

I figured out that the code compiles without any changes or porting efforts.

I use the addon "Visual Micro" in my Visual Studio 2012. Visual Studio saves source files in UTF-8 by default. The compiler of the Arduino 1.5.1 toolchain does not like UTF-8 but prefers ANSI. Changing the encoding of XBee.h; XBee.cpp and MyArduinoProect.ino to ANSI fixed the compiling issues.

There is just one warning left:

XBee\XBee.cpp.o: In function `XBee::begin(long)':
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.cpp:785: warning: undefined reference to `HardwareSerial::begin(unsigned long)'

That's all folks.

I'll keep reporting on how the library performs on the Arduino Due.

Cheers,

Matt

Matt

unread,
Feb 5, 2013, 11:35:07 AM2/5/13
to xbee...@googlegroups.com
Dear all,

after a first check, the xbee-arduino library seems to work on the Arduino Due.

Here is one hint regarding HardwareSerial on the Arduino Due.

Usually I initialize the Xbee object like that:

XBee xbee = XBee();
xbee.setSerial(Serial2);
xbee.begin(YOUR_PREFERED_XBEE_BAUDRATE);

and after that I use the xbee object like:

xbee.send();


I found out, however, that this way throws the warning I mentioned before:

XBee\XBee.cpp.o: In function `XBee::begin(long)':
C:\development\arduino-1.5.1r2\libraries\XBee/XBee.cpp:785: warning: undefined reference to `HardwareSerial::begin(unsigned long)'

...and the serial communication over the passed Serial2 does not work. Obviously, it seems that the passed Serial2 is not opened by invoking "Xbee::begin(long) due to the undefined reference.

Here comes my workaround: If I initialize the XBee object like that:

XBee xbee = XBee();
Serial2.begin(YOUR_PREFERED_XBEE_BAUDRATE);
xbee.setSerial(Serial2);

..,it works and no warning is thrown by the compiler.

I am not an expert but it seems that with the Arduino Due toolchain Serial2 is only instantiated if HardwareSerial.begin(long) has been invoked.

Now, I begin to integrate some logic level shifters in my hardware to interface the Arduino Due with my existing hardware due to the fact that the Arduino Due is not 5V tolerant. After changing my hardware, I will test my "upgraded" prototype and I will report my experiences regarding the xbee-arduino library.

Andrew Rapp

unread,
Feb 7, 2013, 10:00:10 AM2/7/13
to xbee...@googlegroups.com
Hi Matt,

Yes, it was necessary to change the API for softserial support. The
changes are described here
http://code.google.com/p/xbee-arduino/wiki/SoftwareSerialReleaseNotes

Andrew
> --
> You received this message because you are subscribed to the Google Groups
> "xbee-api" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to xbee-api+u...@googlegroups.com.
> To post to this group, send email to xbee...@googlegroups.com.
> Visit this group at http://groups.google.com/group/xbee-api?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

zachary dickerson

unread,
Mar 9, 2013, 4:43:29 PM3/9/13
to xbee...@googlegroups.com
So how has this worked out for the DUE using the newest version from Arduino?  I too would like to port over to the 32bit micro but this is one of the libraries I worry about.  I use xbee pros series 1 in API-2.

zachary dickerson

unread,
Apr 3, 2013, 2:09:31 PM4/3/13
to xbee...@googlegroups.com
I can confirm that DUE works with this library, tested last night w/ my laser tag system successfully.

On Monday, February 4, 2013 6:50:26 AM UTC-5, Matt wrote:

Andrew Rapp

unread,
Apr 4, 2013, 8:49:37 AM4/4/13
to xbee...@googlegroups.com
Thanks for the feedback!


--
Reply all
Reply to author
Forward
0 new messages