stevech wrote:ICAC210 wrote:I figured out the problem, finally. My baud rate was at 19200 going into XBee, not 9600.
I have a question, if i have 3 xbee sending data to my host xbee, do i have to operate in API mode? Would transparent mode work? If so, how does the host xbee distinguish which data is from which xbee?
OK on the wrong baud rate. But you still need code to loop until the UART has room for a byte. You can skip doing that ONLY if your program sends bytes no more often than the time to send one byte, at the chosen baud rate. At 9600baud, that's about 1mSec per byte.
On the question above... no, the 3 XBees can set DL = the address of the "host" Xbee as you say. The 802.15.4 mode has destination addresses you can set at run time using AT commands in your program, if you do the +++ escape with same kind of timing you do with the keyboard.
Also, as I recall, the coordinator in a non-ZigBee network is address 0, so if any XBee addresses its data to 0, it'll go to that node. Also, an all ones destination address is a broadcast - all nodes get the packet, and based on the contents, can ignore or process. Note though, that broadcast packets have no error correction in the MAC layer - you must detect garbled and lost messages in your application with broadcast addresses. Or ignore errors and rely on repeated redundant transmissions or some such.
Thanks for the reply.
I am working on the CTS/RTS right now since I am sending continuous streaming data.
This is the psuedo i have gathered so far, can you see if i am on the right track?
1) Check TRMT... If full, do nothing. If empty, goto 2
2) Check CTS... If busy, do nothing. If clear, load TXREG and goto 3
3) TRMT will now show "full." Wait (do nothing) until it shows "empty."
4) Set a timer for some reasonable period for the XBEE to respond, say 10mS
5) Check CTS... if busy, the byte is done, you can now repeat the main loop. If clear, the XBEE hasn't processed the new byte yet...
6) ...so check the timer... If expired, the XBEE didn't receive the byte. Either reset the serial port or go back to 1 and try resending the byte
Do i need to check TXIF (TXREG)? also, what is the best way to set a timer for delay? Would Nop(); works? Thanks.