Why I can not get the AT Command Response

Hi, guys. I posted my RSSI sender code couple of days ago.

Now, I still have a problem in receiving AT command response. Please take a loot at the code as following:

byte XbeeRSSI(void) {
  byte Serialtester = 0x00; 
  Serial.write((byte) 0x7E); 
  Serial.write((byte) 0x00); 
  Serial.write((byte) 0x04); 
  Serial.write((byte) 0x08); 
  Serial.write((byte) 0x01); 
  Serial.write((byte) 0x44); 
  Serial.write((byte) 0x42); 
  Serial.write((byte) 0x70);
  delay(1000);
    Serialtester = Serial.read();
    return Serialtester;
}

this is only a part of my whole program. I send "ATDB" command to the Xbee radio. It's suppose to return back a response. But as you see, when I read the serial port after 1s delay, I get "FF" rather than "7E" which is a start of a response frame.

How come? Could anyone tell me how I can get a AT command response, please? Thank you.

But as you see, when I read the serial port after 1s delay, I get "FF" rather than "7E" which is a start of a response frame.

No, I can't see that. How do you know that you are getting "FF"? You should only call Serial.read() after calling Serial.available(). The 0xFF means that there was no response (yet).

I send the return value to the coordinator. (That's other parts, which work very well for sure.)

If I use the Serial.available(), I will also get nothing. In fact, that is just my problem: get nothing.

I use X-CTU to send the same code, it response very soon and very well. But when I transfer it to Arduino, it fails.

I use X-CTU to send the same code

How do you send a NULL with X-CTU?

  Serial.write((byte) 0x04); 
  Serial.write((byte) 0x08); 
  Serial.write((byte) 0x01); 
  Serial.write((byte) 0x44); 
  Serial.write((byte) 0x42); 
  Serial.write((byte) 0x70);

The 0x44 and 0x42 are the D and B. What are the other values?

You can check the attachment. I get the pic how I send the frame via X-CTU.

This is a whole frame. It’s a AT command frame.You can check the mean of each byte from Arduino’s manual (or see below). This frame means I will let the Xbee do “ATDB” action.

Frame Fields Offset Example Description
Start Delimiter 0 0x7E Start Delimiter
Length 1 MSB 0x00 Number of bytes between the length and the checksum
2 LSB 0x05
Frame-specific Data Frame Type 3 0x08 API Identifier
Frame ID 4 0x52 (R) Identifies the UART data frame for the host to correlate with a subsequent ACK (acknowledgement). If set to 0, no response is sent.
AT Command 5 0x4E (N) Command Name - Two ASCII characters that identify the AT Command.
6 0x4A (J)
Parameter Value 7 0xE0 If present, indicates the requested parameter value to set the given register. If no characters present, register is queried.
Checksum 8 0x2D 0xFF - the 8 bit sum of bytes between the length and the checksum fields
[/table]

X-CTU send code.bmp (2.24 MB)