Shop OBEX P1 Docs P2 Docs Learn Events
Can Not Wake Up XBee — Parallax Forums

Can Not Wake Up XBee

SELSEL Posts: 80
edited 2012-03-02 00:00 in Accessories
Here is just snippet of my test code:

XB.AT_Config(string("ATSM 1")) <-- put XBee to sleep
Waitcnt(clkfreq * 10 + cnt)
XB.AT_Config(string("ATSM 0")) <--wakeup XBee

The module will go to sleep but will not wake up.

If I use a SIP board all is well, but if I use an Adapter board the module will not wake up!

I need to use the Adapter Board for my projects.

All parts were purchased from Parallax.

I would appreciate any help in this matter

Thank you,
Stan

Comments

  • Tracy AllenTracy Allen Posts: 6,662
    edited 2011-09-24 18:20
    The ATSM 1 command enables control of Sleep and Wake via pin 9 of the XBee. (The pin name is SLEEP_RQ). Once enabled, bringing that pin low is the wake-up signal. Whatever carrier board you use has to make that pin accessible, and your program has to control it.

    The reason the XBee goes to sleep when it hears the ATSM 1 command is probably because it has the pull-up to Vdd enabled on SLEEP_RQ. (Pull-ups are enabled using the ATPR command, and by factory default, all pullups are on). Again, to wake it up, you have to bring XBee pin 9 low, and to put it back to sleep, let the pin go back high or force it high. The ATSM 0 command does not wake it up, but once it is awake, you might use that command to tell the XBee to ignore further sleep requests for a while.
  • SELSEL Posts: 80
    edited 2011-09-25 09:09
    Tracy Allen,

    On both Parallax boards, USB and Adapter, I use Gnd, Vcc, Din, Dout. The SIP board will accept the command: XB.AT_Config(string("ATSM 0")) and wake the XBee.
    Whereas the Adapter Board will accept the command: XB.AT_Config(string("ATSM 1")) and put to sleep the XBee, but will not accept XB.AT_Config(string("ATSM 0")) to wake it up.

    Now as I understand it: The XBee, out of the box, will accept SM 1, but will not accept SM 0. This makes no sense. However your analyze seems spot on!

    So: The Base Node can send an AT command to make the remote sleep, and will have to send something like this to awake the Remote:

    XB.Tx("W") and the remote will need:

    DataIn := XB.Rx

    If DataIn == "W"
    outa[Pin9] := 0 '' this pin from XBee wired to the processor

    Am I correct in my assumption here?

    Tracy I appreciate you help in this matter, and any other thoughts you might have.

    Thank you, very much!

    Stan
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2011-09-25 10:07
    The USB adapter has pin 9 connected to DTR on the FT232 UART, so putting a check in the DTR box will wake the XBee and unchecking it will put the XBee to sleep (given ATSM1).

    On the SIP board, the sleep_rq pin 9 is not brought out to the 5-pin SIP header, but it is available on the 5 pin sip socket, and the pin is labeled "SLP". If you haven't changed the XBee's pullup settings in XCTU or using the ATPU command, that pin will have a pullup resistor enabled, so the XBee should go to sleep as soon as your program gives the ATSM1. It is not surprising that it does not wake up with ATSM0, because the XBee does not listen for commands when it is asleep. Pin 9 has to go low to wake it up first. You have to tie that SLP pin over to a pin on your Stamp or Prop.
  • SELSEL Posts: 80
    edited 2011-09-25 11:42
    It is the Adapter Board that will not respond. The SIP Board will respond to all SM command setting without modification.

    I see the SLP connection on the SIP.

    We do not want to use SIP boards. We want to use Adapter Boards.

    On the bread board with the Adapter Board I have connected a 1 K resistor from Pin 9 to an I/O pin on the Propeller.

    I have not tested this yet. when I do I will post my results. My instinct is that the new modification will work.

    Thank you so very much!
    Stan
  • SELSEL Posts: 80
    edited 2011-09-25 17:57
    Tracy I know you said use pin 9 BUT....

    On the Adapter Board Pin 13 is the Sleep pin and Pin 9 is something else.

    Here is is the code I have been testing with:

    ' Set pins and Baud rate for XBee comms
    XB_Rx = 0 ' XBee DOUT
    XB_Tx = 1 ' XBee DIN
    XB_Baud = 9600 ' XBee Baud Rate

    LED20 = 20 ' LED pin (ack sleep mode)

    HBPin = 2 ' Propeller pin connected to Pin 13 on the Adapter Board.

    OBJ
    XB : "SEL_XBee_Object_v1.0" 'Object renamed to protect original.

    PUB Main | DataIn

    XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee

    XB.AT_Init ' Enable XBee for fast configuration changes

    dira[LED20]~~
    outa[LED20]~

    dira[HBPin]~~

    repeat
    XB.RxFlush ' Flush Rx buffer
    DataIn := 0 ' Clear Data Input

    DataIn := XB.Rx ' Accept incoming byte
    If DataIn == "!" ' If start delimiter
    case (DataIn := XB.RxTime(50)) ' Get LED state w/timeout

    "3":
    XB.RxFlush
    !outa[LED20] ' <--- LED is just a visual aid
    XB.AT_Init
    XB.AT_Config(string("ATSM 1"))
    waitcnt(clkfreq * 5 + cnt) ' DELAY FOR TEST PURPOSES ONLY
    !outa[LED20]
    outa[HBPin] := 0 'Pull SLP pin 13 low
    XB.Delay(100)
    outa[HBPin]~
    XB.Delay(100)

    AFTER THIS CODE EXECUTES THE REMOTE NODE STILL WILL NOT ACCEPT DATA
    FROM THE BASE NODE.

    Where am I going wrong here???
    I would appreciate any help!

    Thank you,
    Stan
  • lrtnorfolklrtnorfolk Posts: 19
    edited 2012-02-16 02:43
    Hello fellow Geeks,
    Does anyone know what the problem is with Stan's code? Is it because his code is for the base unit, and the remote unit will not turn on because once it is asleep, it does not RX or TX? Does anyone have sample code (for base and remote units), using xbee's 802.15.4, demonstrating the sleep function? Thanks for any and all responses. Have a good one.
    Renee
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2012-02-16 08:35
    I was never quite sure which adapter board the OP was referring to. Parallax makes several and it is always a good idea to call it out by number. If it is the #32403 adapter, it simply maps the XBee pin spacing from 2mm to 0.1 inch. The problem was one of misunderstanding the purpose of the pin called "\sleep" (pin 13 on the XBee). That is an output from the XBee that normally connects to an LED that indicates whether or not the XBee is in sleep mode. The pin that controls sleep is XBee pin 9, which is a multipurpose i/o, "DTR/SLEEP_RQ/DIO8".

    The process is simple. Enable command mode with the "ATSM 1", and from then on pin 9 becomes the SLEEP_RQ input. Upon bringing it high, the XBee completes any transactions in progress and then enters low power sleep mode until that pin goes back low. It will neither respond to local commands nor to radio signals when it is asleep.
  • JLockeJLocke Posts: 354
    edited 2012-02-16 20:55
    Here's some code from a remote unit that send the temperature and humidity every 10 minutes via XBee. With putting the XBee to sleep and powering down the propeller between readings, I'm getting about 70 days from a set of 3 alkaline AA batteries. The pin defined as XBEE_SLP is connected to the XBee pin 9.
    PUB cog_Send | waitPer, t
      '' sends current temp/humidity to master unit
      '' on a timed basis (10 min)
      ''  
      Dira[XBEE_SLP]~~                                    ' set XBee sleep pin to output
      Outa[XBEE_SLP]~                                     ' output low... wake XBee
    
      waitPer := 0                                        ' reset wait timer period
      t := (clkfreq + cnt)                                ' set the counter
    
      repeat until (waitPer == 15)                        ' wait for XBee to get set
        waitPer += 1                                      ' increment the count
        waitcnt(t)                                        ' wait
        t += clkfreq                                      ' add one second
        
      sendTemp                                            ' initial data send
      
      waitcnt((clkfreq / 50) + cnt)                       ' wait 20 msec
      Outa[XBEE_SLP]~~                                    ' put XBee to sleep
      waitcnt((clkfreq / 50) + cnt)                       ' wait 20 msec
      cogStop(idMath~)                                    ' stop the floating point cog
      cogStop(idTemp~ - 1)                                ' stop the temperature cog
      _slow_prop                                          ' slow propeller to save power
    
      ' == cog loop ==
      repeat                                              ' loop
        waitPer := 0                                      ' &#9500;&#9472; reset wait timer period
        t := (clkfreq + cnt)                              ' &#9500;&#9472; set the counter
                                                          ' &#9474;
        repeat until (waitPer == CYCLE)                   ' &#9500;&#9472; wait until cycle time to send
          waitPer += 1                                    ' &#9474;  &#9500;&#9472; increment the cycle timer
          waitcnt(t)                                      ' &#9474;  &#9500;&#9472; wait
          t += clkfreq                                    ' &#9474;  &#9492;&#9472; add one second to the counter
                                                          ' &#9474;
        _slow_to_fast_prop                                ' &#9500;&#9472; speed up the propeller
        idMath := Flt.start                               ' &#9500;&#9472; start floating point object
        idTemp := cognew(cog_Temps, @stackTmtr) + 1       ' &#9500;&#9472; launch the temp/humidity cog
        Outa[XBEE_SLP]~                                   ' &#9500;&#9472; output low... wake XBee
                                                          ' &#9474;
        waitcnt((clkfreq * 2) + cnt)                      ' &#9500;&#9472; wait 2 seconds for temp to update
        sendTemp                                          ' &#9500;&#9472; send the data
        waitcnt((clkfreq / 50) + cnt)                     ' &#9500;&#9472; wait 20 msec
                                                          ' &#9474;
        Outa[XBEE_SLP]~~                                  ' &#9500;&#9472; pin high... XBee asleep
        cogStop(idMath~)                                  ' &#9500;&#9472; stop the floating point cog
        cogStop(idTemp~ - 1)                              ' &#9500;&#9472; stop the temperature cog
        _slow_prop                                        ' &#9492;&#9472; slow propeller to save power
    
    
  • lrtnorfolklrtnorfolk Posts: 19
    edited 2012-02-17 22:33
    Tracy, JLocke,
    Thanks for the help. I should be able to get my xbee's working based on your help (when they arrive). Thanks again.
    Renee
  • lrtnorfolklrtnorfolk Posts: 19
    edited 2012-03-01 23:58
    <P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Arial', 'sans-serif'; COLOR: #222222; FONT-SIZE: 12.5pt; mso-ansi-language: EN" lang=EN>Tracy, Jlocke,<BR><BR>Got my xbee's (pro, 802.15.4) 3 days ago.  They work exactly as you described.  I only wish I had bought the xbee pro with external ant.  I need to mount the remote xbee in a plastic box with the antenna sticking out of it.  I think if I don't do this, the box will provide some attenuation.  Oh well, they are only $32.  I also need to buy the xbee adapter board.  I purchased the USB and 5B to 3V adapter boards and noticed they have several LED's on them.  I need to make the project very power efficient, since it will operate on batteries. The xbee adapter board is only a few bucks.<SPAN style="mso-spacerun: yes">  </SPAN>Guess I will be placing another order soon.<SPAN style="mso-spacerun: yes">  </SPAN>Once again, Thanks for your assistance.  Have a great weekend.<BR><BR>Renee</SPAN></P><BR> 
  • lrtnorfolklrtnorfolk Posts: 19
    edited 2012-03-02 00:00
    lrtnorfolk wrote: »
    <P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Arial', 'sans-serif'; COLOR: #222222; FONT-SIZE: 12.5pt; mso-ansi-language: EN" lang=EN>Tracy, Jlocke,<BR><BR>Got my xbee's (pro, 802.15.4) 3 days ago.  They work exactly as you described.  I only wish I had bought the xbee pro with external ant.  I need to mount the remote xbee in a plastic box with the antenna sticking out of it.  I think if I don't do this, the box will provide some attenuation.  Oh well, they are only $32.  I also need to buy the xbee adapter board.  I purchased the USB and 5B to 3V adapter boards and noticed they have several LED's on them.  I need to make the project very power efficient, since it will operate on batteries. The xbee adapter board is only a few bucks.<SPAN style="mso-spacerun: yes">  </SPAN>Guess I will be placing another order soon.<SPAN style="mso-spacerun: yes">  </SPAN>Once again, Thanks for your assistance.  Have a great weekend.<BR><BR>Renee</SPAN></P><BR> 

    Tracy, Jlocke,

    Got my xbee's (pro, 802.15.4) 3 days ago. They work exactly as you described. I only wish I had bought the xbee pro with external ant. I need to mount the remote xbee in a plastic box with the antenna sticking out of it. I think if I don't do this, the box will provide some attenuation. Oh well, they are only $32. I also need to buy the xbee adapter board. I purchased the USB and 5B to 3V adapter boards and noticed they have several LED's on them. I need to make the project very power efficient, since it will operate on batteries. The xbee adapter board is only a few bucks. Guess I will be placing another order soon. Once again, Thanks for your assistance. Have a great weekend.

    Renee

    Sorry, the first post got geeked-up
Sign In or Register to comment.