receiving 0xff. iteaduino mega+wireless SD shield+Xbee 802.15.4

Hi, i hope you can help me with this trouble.

I am working with the iteaduino mega connected to an xbee 802.15.4 module through the wireless sd shield. On the other way i have another xbee 802.15.4 connected to my computer with an USB adapter from Libelium. i'm working in trasparent mode. The baudrates are all configured to 9600.

The iteaduino uses the Serial2 to communicate with the xbee module attached to it. I'm able to tx the data that i want from the iteaduino to the computer but when i tried to receive data from the computer, the iteaduino only read each byte like 0xFF, regardless i'm sending a frame like this: 7e117eabcdefabcd000099. It looks like an API frame because i want to simulate that mode of operation to learn how the xbee modules work.

this is my code:

void setup() {
Serial2.begin(9600);
Serial.begin(9600);
}

void loop() {
int* RX = (int*) calloc(20,sizeof(int));
for(int i=0;i<21;i++){
RX*=0;*

  • }*

  • int contRx=0;*

  • if (Serial2.available() > 0) {*

  • while (contRx<=Serial2.available()) {*

  • RX[contRx] = Serial.read();*

  • Serial.println("I received: ");*

  • Serial.println(RX[contRx], HEX);*

  • contRx++;*

  • }*

  • }*
    }
    serial monitor:
    I received:
    FFFFFFFF
    I received:
    FFFFFFFF
    I received:
    FFFFFFFF
    I received:
    FFFFFFFF
    ...