Unable to Read Xbee with Serial Mega 2560

Hi,

I have a problem with reading API frame by using serial port with firstly activating on XCTU

1.XB S3B : API MODE : coordinator
2.Parallax mini USB xbee adapter

Info of Xbee adapter

I connect DIN(xbee) to Rx(Mega) and DOUT(xbee) to Tx (Mega) with Voltage divider

by Xbee is connected to serial2 of Mega and the serial0 of mega is connected to USB port (Labtop )

below is the code and it works perfectly

int value = 0; 
// the setup routine runs once when you press reset:
void setup() 
{
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  Serial2.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() 
{
  if(Serial2.available()>25) 
//> 25 byte = is equal to 26 byte (22 byte standard + 4 byte for 2ADC ( 2 byte /1 ADC)
  {
    for (int i=0;i<26;i++)   /
/<26 byte means that equal to 26 byte (0 to 25)
    {
    Serial.print(Serial2.read(),HEX);
    Serial.print(",");
      //value = Serial2.read();
      
      
     } 
    Serial.println();
  
  }
      
}

but the problem is that
I can see the API frame when I connect Xbee module with XCTU.
I can read API frame as in XCTU as the same as in Arduino Serial monitoring.
This is because I directly connect DIN and DOUT PIN to serial2 Mega.

After that I closed the XCTU " without RESET XBEE ",
the serial monitoring can still read API frame.

but when i disconnect Xbee from XCTU and " press RESET on xbee " or
"re-energize power supply "
There is nothing out from DIN and DOUT of Xbee

What should I do if I want to read API frame by Serial Mega2560 only and “without using XCTU” ?

thanks for comments

did you join the grounds?

J-M-L:
did you join the grounds?

I am not sure the does GND join together or not.

Because

Xbee+adapter+Mini-usb-port connect to my laptop USB port1.
For arduino+serial port connect to my laptop USB port2.

Only DIN and DOUT of Xbee connects to Tx and Rx serial port2 of arduino.

CTS’ = 0 only when open with XCTU, so I can read the receiving data from Arduino

but when close XCTU and reset Xbee CTS’ returns to 3.3V (1), so can’t get any data

Do i have to force RTS’ to GND? becuase now this pin disable
and how to makt CTS’ of xbee to equal to 0 for receiving the data to Arduino.

Draw a diagram of what you have and post a picture not sure I follow you

J-M-L:
Draw a diagram of what you have and post a picture not sure I follow you

PIC is in the attachment, sir.

J-M-L:
Draw a diagram of what you have and post a picture not sure I follow you

Ok - it does not clarify that statement

but when i disconnect Xbee from XCTU and " press RESET on xbee " or "re-energize power supply "

How do you physically disconnect re-energize? Does the usb cable to the adapter plate stays there? (You understand it’s a pass through serial, so impacts the tx/rx, right so seems a bit ambitious to have Rx of your xbee connected (and doing a junction) to the two Tx of the PC)

Have you tried putting a wire from ground of the arduino to ground of the xbee?

J-M-L:
Ok - it does not clarify that statement
How do you physically disconnect re-energize? Does the usb cable to the adapter plate stays there? (You understand it’s a pass through serial, so impacts the tx/rx, right so seems a bit ambitious to have Rx of your xbee connected (and doing a junction) to the two Tx of the PC)

Have you tried putting a wire from ground of the arduino to ground of the xbee?

I just remove it from laptop USB port and re-connect it again

I will try putting ground wire as you recommended.

Thanks.

when you unplug there is no more common ground between your Arduino and the xBee

arduino gets its ground form the computer USB

Parallax mini USB xbee adapter gets its ground from the second USB and carry it through the xBee that is plugged in

that's how the arduino and the xBee have a shared ground.

when you unplug the second USB, the Xbee is loosing the reference to GND and thus can't tell what is High and what is low

Also as said above this seems a weird wiring, you either connect through USB or through the Serial Pins but I'm unsure what doing both at the same time does : your board Rx creates a bridge between two Tx pins if one is HIGH and the other LOW you kinda short a pin to ground through your xBee... that's usually not good...

J-M-L:
when you unplug there is no more common ground between your Arduino and the xBee

arduino gets its ground form the computer USB

Parallax mini USB xbee adapter gets its ground from the second USB and carry it through the xBee that is plugged in

that's how the arduino and the xBee have a shared ground.

when you unplug the second USB, the Xbee is loosing the reference to GND and thus can't tell what is High and what is low

Also as said above this seems a weird wiring, you either connect through USB or through the Serial Pins but I'm unsure what doing both at the same time does : your board Rx creates a bridge between two Tx pins if one is HIGH and the other LOW you kinda short a pin to ground through your xBee... that's usually not good...

I tried to connect Xbee's GND to Arduino's GND and V_in Xbee adapter to +5V Arduino board as you recommended but there are no any responses. I have also check /CTS of XBee.

When I connected Xbee with XCTU, /CTS Xbee PIN automatically = 0, so XCTU could read data from Xbee but when I connected Xbee back to Arduino board. Why is the /CTS PIN of Xbee not equal to 0

Or, Does it have a problem with my Xbee adapter ? because the PIN DIN DOUT /CTS /RTS /DTS
are connected to chip FDTI for Mini USB

How about if I change to PARALLAX SIP as link below
parallax SIP

I give you a schematic of xbee adapter in dropbox.

Below is the link to my dropbox I captured PIC and configuration.

dropbox

Thank you in advance!

In configuration,
I do not change any setting values in sleeping mode and I am not sure that is it relevant to /CTs or not?

I dont understand why you want two serials connected at the same time