Shop OBEX P1 Docs P2 Docs Learn Events
Xbee XCTU Range Test — Parallax Forums

Xbee XCTU Range Test

WildatheartWildatheart Posts: 195
edited 2010-04-19 01:00 in BASIC Stamp
Has anyone run the "Range Test" in the XCTU software?

Although my Xbee's do seem to give somewhat predictable results, the Range Test in XCTU shows a small number of "good" and A LARGE number of "bad"... 'whatevers'. If I set the switch to stop on error, it stops all the time.

The transmitting Xbee BS2 is programed to generate X+1 in a loop and sending it out. I am trying to use flow control, but it's hard to tell if flow control is working or if one of the buffers are overflowing. Does anyone have knowledge of the buffer size for either the BS2 or the Xbee - whichever seems to be overflowing culprit? Perhaps flow control needs to go both ways?

Gordon

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-04-18 16:25
    If I remember right the range test expects to be talking to itself. The remote xbee should have its rx and tx looped so it sends back what it receives.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-04-18 22:04
    You do remember correctly - the tx and rx need to be connected.
    But I assume that's not OP's problem - he wouldn't be getting _any_ good whatevers if he didn't have it connected properly.

    I've had what I thought were surprising numbers of bad reports as well when I've run range tests (even with the units just a couple of feet apart). But at the same time, I've had very good, consistent results with the XBees in practice. I think that the retries make up for a multitude of sins, as it were.
  • WildatheartWildatheart Posts: 195
    edited 2010-04-19 01:00
    sylvie, thanks for the comments. On both the transmitter and the receiver I have Pin 2 of the BS2's tied to RTSn of each XBbee. Both the tx and the rx stamp programs are attached. I am initiating flow control in the rx program only - perhaps the tx program should also initiate flow control - not sure. The rx program does receive and display orderly numbers from 0 to 50, and then cycles the bilge pump motor. While the tx program continues chugging along 'counting', it does wait till the bilge pump cycles and with a new keypress Debug begins to display, 51, 52, etc. So... some sort of flow control must be working.

    With the rx setup connected via USB to XCTU the "Terminal" tab display window displays, and cycles accurately, the numbers 0 to 100 when the tx setup is powered. ...yet the unexpected results in the "Range Test" I should hope these are not all "retries" as you suspect. Good grief, the old 400 Mhz got it right on the first time around. This baby is supposed to be better than that. Interesting. But I would like to know more about the Range Test.

    Then... earlier I asked about buffer overflow - any idea what the buffer size is (either or both the BS2 debugin and the Xbee) because it's obvious that if a key isn't pressed quickly enough to empty the buffer, an overflow is apparant.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '****************************************************************************
    ' rx_flow_control with HB25 cycle.bs2

    ' Hardware: 2 OEM BS2 micros with 2 Xbee radios

    ' Receive decimal value from transmitter and
    ' display in DEBUG Window of receiver using flow control

    ' If transmitted value = 50 then cycle the bilge pump
    ' and then continue to wait for keypresses to accept additional decimal values
    ' from transmitter

    ' Transmitter is programed to count continuously and send values from 0 - 255
    '*****************************************************************************

    RX PIN 0 ' Receive Pin
    TX PIN 1 ' Transmit Pin
    RTS PIN 2 ' RTS flow control pin

    '
    [noparse][[/noparse] Variables ]
    index VAR Word ' Counter For Ramping
    X VAR Byte



    '
    [noparse][[/noparse] HB25 Initialization ]
    HIGH TX
    HB25 PIN 15 ' I/O Pin For HB-25 ' Idle transmit pin

    DO : LOOP UNTIL HB25 = 1 ' Wait For HB-25 Power Up
    LOW HB25 ' Make I/O Pin Output/Low
    PAUSE 5 ' Wait For HB-25 To Initialize
    PULSOUT HB25, 750 ' Stop Motor
    PAUSE 1 ' 1 mS Delay

    '
    [noparse][[/noparse] Xbee Inlitalization ]
    DEBUG CLS, "Configuring XBee for flow control", CR
    PAUSE 2000 ' 2 second guard time
    SEROUT TX, 84,[noparse][[/noparse]"+++"] ' Enter command mode
    PAUSE 2000 ' 2 second guard time
    SEROUT TX, 84,[noparse][[/noparse]"ATD6 1",CR] ' Enable flow control
    SEROUT TX, 84,[noparse][[/noparse]"ATCN",CR] ' Exit command mode

    '
    [noparse][[/noparse] Main ]
    Main:
    DO
    DEBUG "Press a key to retrieve data in buffer", CR
    DEBUGIN X
    ' Wait for key press
    GetData:
    SERIN RX\RTS, 84,100,Timeout,[noparse][[/noparse]DEC x] ' Receive data with 100mS timeout/flow control
    DEBUG " ",DEC X ' Display data
    IF x = 50 THEN GOSUB Motor ' Cycle bilge pump
    IF x = 50 THEN GOTO Main
    GOTO GetData ' Loop back for more data

    Timeout: ' No data, repeat
    LOOP

    '
    [noparse][[/noparse] Cycle bilge pump ]
    Motor:

    PAUSE 20 ' Wait 20 mS Before Ramping

    FOR index = 0 TO 250 ' Ramp Up To Full Speed
    PULSOUT HB25, 750 + index ' Motor 1 Forward
    PAUSE 20 ' 20 mS Smoothing Delay
    NEXT

    PAUSE 500 ' Wait 3 Seconds

    FOR index = 250 TO 0 ' Ramp Back Down
    PULSOUT HB25, 750 + index ' Motor 1 Forward Slowing
    PAUSE 20 ' 20 mS Smoothing Delay
    NEXT

    RETURN



    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '***********************
    ' Simple_tx.bs2
    ' Example to transmit decimal
    ' values 0 to 255
    ' ***********************
    RX PIN 0 ' Receive Pin
    TX PIN 1 ' Transmit Pin
    X VAR Byte
    HIGH TX ' Idle transmit pin

    Main:
    FOR x = 1 TO 100
    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 20
    NEXT
    GOTO Main
Sign In or Register to comment.