Shop OBEX P1 Docs P2 Docs Learn Events
how do I troubleshoot these xbees?? — Parallax Forums

how do I troubleshoot these xbees??

AnnoyingAnnoying Posts: 50
edited 2010-04-05 19:47 in BASIC Stamp
this is very frustrating! So I have two xbees on 5 V/3.3 adapters connected to two separate BS2's. I took them out of the box, soldered the adapter kits, attached the xbees, used this simple code that was in this document (http://selmaware.com/appbee/AppBee_Doc.PDF):

' {$STAMP BS2}
' {$PBASIC 2.5}
RX PIN 0 ' Receive Pin
TX PIN 2 ' Transmit Pin
X VAR Byte
HIGH TX ' Idle transmit pin
DO
X = X + 1
SEROUT TX,84, [noparse][[/noparse]DEC X,CR,CR] ' Send value of X as decimal
' Second CR is added byte buffer for flow control example
PAUSE 500
LOOP
To receive:
' {$STAMP BS2}
' {$PBASIC 2.5}
' ***************************
' simple_rx.bs2
' Example to receive decimal value
' and display in DEBUG Window
' ***************************
RX PIN 0 ' Receive Pin
TX PIN 2 ' Transmit Pin
X VAR Byte
HIGH TX ' Idle transmit pin
DO
SERIN RX, 84, [noparse][[/noparse]DEC x] ' Receive data
DEBUG DEC X, CR
LOOP


It did not work. The green ASC LEDs were blinking on the two adapters at first and suddenly one of them stopped blinking and now whenever I connect that adapter to power, the red RSS LED·is·dimly on. I have no idea why. I'm also confused about the "configuration" that·is also in that document.·First of all, I don't understand the purpose of the configuration. I did it anyway and it said "configuration complete" when I tried the code for both adapters. I checked that the adapters are getting 5 V. I have an oscilloscope I tried to use for debugging, but·it doesn't even show a change when I put the oscilloscope lead on the TX pin.·Where do I go from here? How can you test each·xbee module·individually? I swapped the xbees between the two adapters and the·adapter that wasn't blinking green remained the same, so I know the xbee itself isn't to blame for that. ·

Comments

  • SRLMSRLM Posts: 5,045
    edited 2010-04-01 02:27
    Are you using the correct pins? The code that you posted uses pin 0 to receive and pin 2 to transmit on. Can you post a picture of your setup (so that we can see the wires and breadboard). Also, you may want to check your power connections. Assuming that you're using the Parallax adapter board, quote "Do not connect an additional external voltage supply to the VCC pin if power is already applied through VDD. This could damage to your XBee module."

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Powered by enthusiasm
  • AnnoyingAnnoying Posts: 50
    edited 2010-04-01 04:11
    I'm actually using the adapter board from the company Adafruit, and even though my soldering job looks flawless, I think there may be microscopic bits of solder disrupting connections, so i'm going to buy a solder brush to clean it up tomorrow, hopefully it works. I'm still really confused about the whole purpose and necessity of the xbee configuration thing though.
  • FranklinFranklin Posts: 4,747
    edited 2010-04-01 15:43
    Annoying said...
    I'm still really confused about the whole purpose and necessity of the xbee configuration thing though.
    It's what you do to make the xbees do what you want. How they communicate, what protocol they use, what firmware the have, what address and name they use to talk to each other. Things like that. The xbee manual will help you understand this and the software from digi (X-CTU) will allow you to do this.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • AnnoyingAnnoying Posts: 50
    edited 2010-04-02 03:34
    I FIGURED IT OUT! apparently microscopic bits of solder were disrupting the circuit, so I brushed it off and it works now! so as for the configuration, should they already be set to communicate out of the box?
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-04-02 12:29
    They'll communicate, but only if the addresses are set correctly. If you haven't already done so, download the X-CTU software from Digi to configure your modules, and then read this document to learn how to configure your modules:

    http://selmaware.com/appbee/AppBee_Doc.PDF

    You should also download a copy of the XBee manual from Digi, and read through the first sections. If you're going to work with XBees, there's a lot you should learn to make your work easier.
  • AnnoyingAnnoying Posts: 50
    edited 2010-04-02 23:49
    ahhh I'm so confused now. So in the selmaware document, it said the xbees could be configured through the basic stamp, so are you saying that you have to download the X-CTU software from Digi to get them to work? I don't know if it'll work because I have windows vista, which wasn't listed as a compatible OS. I ran the code in "Configuring the XBee from Code" section of that selmaware document on both modules, and now the green LEDs on both adapters are blinking at the same rate, which seems like a good sign. but the simple code at the very beginning of that document doesn't work still.
  • FranklinFranklin Posts: 4,747
    edited 2010-04-03 01:15
    Keep working, you will get it. If you want to follow someone elses instructions that's fine but you will have to tell us exactly what you did, what your settings are now and what it is you are trying to do and how you are trying to do it. I believe you need X-CTU to update the modules to the latest firmware and I would recommend you do that before going any further.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • AnnoyingAnnoying Posts: 50
    edited 2010-04-03 02:25
    so I looked up X-CTU and found

    http://www.digi.com/support/productdetl.jsp?pid=3352&osvid=57&tp=5&s=316

    I clicked on "PKG-U USB Drivers for Windows 98 SE - XP" and after unzipping the folder, clicked on FTDIUNIN.exe and it gave me the error:

    Error, file not found

    C:\Windows\system32\FTDIUN2K.INI

    Press Finish to exit.

    is this the right way to get X-CTU? thanks.
  • AnnoyingAnnoying Posts: 50
    edited 2010-04-04 00:31
    wow it turns out that I was supposed to connect the RX pin on the adapter to TX on the BS2 and visa versa, so the simple program I posted at the beginning works now! I am confused about how it's working without having done the X-CTU thing, I ran the "configuring with code" that was in the selmaware document, so I'm wondering why everyone doesn't just configure them through code.
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-04-04 00:36
    Oh, it's just fine to configure the XBees through your code - I'm doing that on my main project here, with a Prop chip as controller. But as a beginner I found it very helpful to use XCTU, because I could see all of my settings, and change them just by changing a value in a text box. You can change them through a terminal program as well, though you can't see all of your settings at once that way.

    The nicest thing about changing the settings through the code is that you don't have to remember which XBee was set up with which settings.
  • AnnoyingAnnoying Posts: 50
    edited 2010-04-04 01:31
    thank you so much...one last question: so I'm trying to transmit accelerometer data back and forth, which is Word sized, so it doesn't work with the SERIN command that was in the selmaware document in the form SERIN RX\RTS, Baud, [noparse][[/noparse]ByteVariable].
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-04-04 03:00
    Send the two bytes separately. For example, if you have

    Accel VAR WORD

    Then Accel.HighByte and Accel.LowByte refer to the two bytes that make it up. Send the two separately, and you can deal with the variable as though you'd sent it all at once.
  • AnnoyingAnnoying Posts: 50
    edited 2010-04-04 04:38
    ohhh I remember that now, thanks so much! i'm almost there now, but I still have a little trouble. When I debug the accelerometer value on the BS2 that is transmitting, I get a four digit number like I should. but when I debug the received value on the other BS2, I get a completely different 5 digit number. I'm sure there is a small obvious mistake somewhere, this is my code:

    TRANSMITTING:
    RX PIN 12 ' Receive Pin
    TX PIN 13 ' Transmit Pin
    Yin PIN 10 ' Y input from Memsic 2125
    HiPulse CON 1 ' measure high-going pulse
    pulse VAR Word


    Main:

    PULSIN Yin, HiPulse, pulse

    HIGH TX ' Idle transmit pin
    DO

    SEROUT TX,84, [noparse][[/noparse]DEC pulse.HIGHBYTE,DEC pulse.LOWBYTE,CR,CR]
    DEBUG ? pulse
    PAUSE 500
    LOOP
    RECEIVING:
    RX PIN 7 ' Receive Pin
    TX PIN 6 ' Transmit Pin
    pulse VAR Word

    HIGH TX ' Idle transmit pin
    DO

    SERIN RX, 84, [noparse][[/noparse]DEC pulse.HIGHBYTE, DEC pulse.LOWBYTE]

    DEBUG ? pulse



    LOOP

    THANK YOUUUUU!!!
  • stamptrolstamptrol Posts: 1,731
    edited 2010-04-04 21:37
    · On your recieving unit, assuming it is up and running when the transmitter starts sending , it will·see a total of FOUR bytes (highbyte, lowbyte plus 2 CR's).

    · Because the receiver is only·expecting two bytes, it easily gets out of sync with the transmitter. What you are debugging is some combination of highbyte + lowbyte, or lowbyte plus CR,·CR + CR, or CR+highbyte.

    · The way to fix it is to always send a special character (like *) before highbyte and lowbyte. On the receiver, use the WAIT instruction with SERIN to tell it to only grab the two bytes after it sees the *.

    · On Transmitter: SEROUT TX,84, [noparse][[/noparse]"*",DEC pulse.HIGHBYTE,DEC pulse.LOWBYTE,CR,CR]

    · On Receiver:· SERIN RX, 84, [noparse][[/noparse]Wait ("*"), DEC pulse.HIGHBYTE, DEC pulse.LOWBYTE]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • AnnoyingAnnoying Posts: 50
    edited 2010-04-05 01:43
    thanks for the advice! but for some reason I'm still getting a disparity...the DEBUG ? pulse· on the receiving BS2 is 58596 while the pulse on the transmitting BS2 is 2482. any reason for this?? ahhhhh!
  • stamptrolstamptrol Posts: 1,731
    edited 2010-04-05 12:07
    ·In the respective SEROUT and SERIN, drop the DEC modifiers for highbyte and lowbyte and give that a try.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • AnnoyingAnnoying Posts: 50
    edited 2010-04-05 18:20
    Thank you so much, it works now, case closed!!!!!!! [noparse]:)[/noparse]
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-04-05 19:47
    Excellent. Congratulations, and have fun.
Sign In or Register to comment.