Home  >  Support  >  Support Forum  >  Urgently need help with Xbees not sending and recieving correct data

Urgently need help with Xbees not sending and recieving correct data

0 votes
I have an Xbee pro attached to my PC and an Xbee Pro S1 attached to a 32bit MCU via UART (Rx and Tx).

I've tested the Xbees and was able to get communication between the two, with one connected to PC, the other connected to 3.3v and it's Rx wired directly to Tx.

BUT once I attach to the MCU I cannot read or write to that XBee correctly.

Here is my config (same for both Xbees except the DH and DL values.. which are set to the opposite Xbee's serial numbers)
everything else was left at factory default

In X-CTU I've got the terminal set up as a baudrate of 9600 8-N-1 for connection.

My MCU code is MPLAB and if it would help I can post, but the basic idea is:
code interrupts when data is detected in Rx buffer. Rx is read and echo'd back to the PC. an LED is turned on.

Now I know that the MCU is recieving data, as the LED lights up... but if I ask it for specific data, such as "turn led on only after recieving a 'k' or 'K', then the LED wont light... this gives me the impression that although data is getting across, it's not what is ment to be sent. In addition I'm getting no responses on my PC. I'm using X-CTU terminal, but still nothing.

any advise would be excellent. Below in the 2 links are screen caps of my Xbees' configurations as seen in X-CTU

Xbee on PC
<a href="http://imgur.com/tvdYcTc"><img src="http://i.imgur.com/tvdYcTc.png?1" title="Hosted by imgur.com" /></a>
Xbee on MCU
<a href="http://imgur.com/eFM74Zd"><img src="http://i.imgur.com/eFM74Zd.png?1" title="Hosted by imgur.com"/></a>

If it's useful here is the MPLAB code for 32bit MCU:
#ifdef __XC32 #include <xc.h> #endif #include <plib.h> #include <stdint.h> #include <stdbool.h> #include "user.h" #include "system.h" #include <GenericTypeDefs.h> #include <stdlib.h> #define SYSFREQ (80000000UL) #define PBCLK (SYSFREQ/2) #define DESIRED_BAUDRATE (9600) #define BAUD_VALUE ((PBCLK/16/DESIRED_BAUDRATE)-1) #define MAX_BUF_BYTES 256 #pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF #pragma config POSCMOD = XT, FNOSC = PRIPLL, FPBDIV = DIV_2, CP = OFF //Fpb=40,000,000 int switcherX=0; // represents the ON/OFF switch void sendACK() { unsigned char t = 't'; putcUART2(t); } int32_t main(void) { DDPCONbits.JTAGEN = 0; int pbClk; pbClk=SYSTEMConfig(SYSFREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE); TRISFbits.TRISF3=0; LATFbits.LATF3=0; OpenUART2(UART_EN, // Module is ON UART_RX_ENABLE | UART_TX_ENABLE, // Enable TX & RX pbClk/16/DESIRED_BAUDRATE-1);// 9600 bps, 8-N-1 // Configure UART2 RX Interrupt ConfigIntUART2(UART_INT_PR2 | UART_RX_INT_EN); // Must enable glocal interrupts INTEnableSystemMultiVectoredInt(); while(1) { }; return 0; } // UART interrupt handler // it is set at priority level 2 void __ISR(_UART2_VECTOR, ipl2) IntUart2Handler(void) { // Is this an RX interrupt? if(mU2RXGetIntFlag()) { //sendACK(); // Clear the RX interrupt Flag mU2RXClearIntFlag(); // Echo what we just received. putcUART2(ReadUART2()); // Toggle LED to indicate UART activity if(switcherX==0){ LATFbits.LATF3= 1; switcherX=1; } else{ LATFbits.LATF3 = 0; switcherX=0; } } // We don't care about TX interrupt if ( mU2TXGetIntFlag()){ mU2TXClearIntFlag(); } }
asked Dec 11, 2013 in RF Solutions and XBee by jambox5 New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
I am not an expert of xbee or your MCU dev board but if you suspect you are not receiving the right data on MCU, find a way to send what it receives to a TTL USB adapter so you can watch it on your PC. Does your MCU board have 3.3V logic and the TTL UART logic with 8-n-1?
answered Dec 18, 2013 by liudr New to the Community (41 points)
Contact a Digi expert and get started today! CONTACT US