I am trying to test simple communication between a Xbee on my Arduino Due and a Xbee linked to XTCU. I attached jumper wires from RX and TX to RX1 and TX1 (Serial 1 hardware port) but I cannot send or receive data between the Xbees. I tested the Xbees previously with an Arduino Zero talking to the XTCU and it worked flawlessly.

Extra information: I am using a Xbee Shield on my Arduino Due (as shown in the picture)

char c,d;

void setup() 
// put your setup code here, to run once:


void loop() 
// put your main code here, to run repeatedly:
if (Serial1.available())
 c = Serial1.read();
else if (Serial.available())
 d = Serial.read();


My wiring is attached. What am I doing wrong?enter image description here

  • Are you using an Xbee shield? And doesn't it connect to pin 0 (RX) and 1 (TX)? – Mikael Patel Mar 18 '17 at 20:51
  • @MikaelPatel Yes, I am using a Xbee Shield. Yes, but since there is no SoftwareSerial library, I have to use one of the multiple hardware serial ports to read data from the Xbee, hence the jumper wires. – suky Mar 18 '17 at 20:53
  • So you have cut the pins from the Xbee Shield? Pin 0 and 1 are not connect to the corresponding pins on the due? – Mikael Patel Mar 18 '17 at 20:55
  • The pins used for SoftwareSerial are pins 2 and 3 (according to the documentation of the shield). I guess you could put them in input mode and connect to a hardware serial port (Serial1). – Mikael Patel Mar 18 '17 at 20:57
  • @MikaelPatel Actually, my jumper wire setup was correct but I had to flick a switch on the shield to communicate via UART. Thank you for your responses, though! I have another question (in the answers). I'm probably missing something simple in my code. – suky Mar 18 '17 at 21:32

I fixed my problem. I stupidly left the Xbee Shield on DLINE instead of UART. Now there is communication between the radio modules. I have another question. When I type a character into XTCU, it "receives" the exact character from the Arduino Due. I have used this basic code with other Arduinos before and this has never happened.

Extra information: The serial monitor solely prints out received data.

I attached an example. enter image description here

| improve this answer | |
  • Please accept your own answer to close this question. – user31481 Nov 16 '17 at 19:32

Has there been any update on this problem? Your post has been incredibly helpful as I've been looking for ways to use a Due and an Xbee (specifically with the Sparkfun Xbee shield).

I haven't been able to solve this entirely, but I've noticed a few things; First of all if you delete the second Serial.available, it does not change the functionality of the code at all, still works the same way. I believe this has to do with the hardware Tx and Rx pins on the Due.

What seems to be happening is that if you use XCTU to send information to the Due, XCTU sends the data out, in which the Due receives it. Then it bounces back and seemingly resends it from the Due to XCTU again, without displaying in the serial monitor. I'm probably wrong in my observations but very curious if there's an answer to this. Hope to hear back from someone soon. Thanks!


Upon thinking about it, I figured out a work around. As stated in one of the comments earlier, you still have the shield's Rx and Tx pins connected to the Due. This is what's giving you double values on XCTU. The Due receives the input from XCTU and immediately sends it back out to XCTU. A simple fix is bending the Rx and Tx pins out slightly so they are not connected to the Due but all of the other pins remain in place. I hope this ends up being helpful!

| improve this answer | |
  • There is no second Serial.available the other one is Serial1.available with 1 at the end. – gre_gor Jul 19 '17 at 17:18
  • Yes, I figured out that work around a few weeks back! Sorry I didn't say anything! – suky Jul 21 '17 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.