Shop OBEX P1 Docs P2 Docs Learn Events
XBee troubles: receives fine with PST and X-CTU but not with Propeller — Parallax Forums

XBee troubles: receives fine with PST and X-CTU but not with Propeller

Ken GraceyKen Gracey Posts: 7,401
edited 2009-10-30 19:31 in Propeller 1
Hey there,

Not much in this program, but apparently enough for me. The transmitting XBee module is sending data the way it should be, which I can verify with another XBee connected to a SparkFun USB carrier board. The data properly streams into either Parallax Serial Terminal or the XB X-CTU utility. Therefore I have verified operation of the transmitter and that the two XBee modules are configured similarly. Transparent mode, not API mode.

However, I'm unable to receive it with the Propeller and display it back into PST or anywhere else.

Transmitting connections:
XBee Vcc to Propeller VDD (3.3V)
XBee Din to Propeller 5
XBee Gnd to Propeller Gnd
- nothing else connected

Receiving connections:
XBee Vcc to Propeller VDD (3.3V)
XBee Dout to Propeller 24 (P25 is not connected - will read XBee docs to see if this is necessary)
XBee Gnd to Propeller Gnd
- nothing else connected

PST is properly configured at 9600 bps on the correct COM port. I've tested this setup without the RF receiving lines of code, and it works fine.

I am pretty sure my problem is in the usage of the XB_Object. Once in a while I receive a few bytes of trash, but nothing like I've seen when I'm doing XBee from Prop to USB transmissions.

Any help would be appreciated. I've struggled with this one until late last night.

Thanks,

Ken Gracey

''*****************************************************
''*  XBee RF Transmitter Example                      *
''*  Uses XB24 to send a byte at a time               * 
''*  Author: Ken Gracey                               *
''*  Date: November 2009                              *
''*****************************************************

CON 
    _clkmode = xtal1 + pll16x      '80MHz operating frequency.
    _xinfreq = 5_000_000                      
    Hz    = 100     

OBJ 
  XB   : "XBee_Object"       
  Comm : "FullDuplexSerial"  
  Num  : "Numbers"

VAR     long          value  

Pub Start | check
    XB.start(6,5,0,9600)           ' XBee Comms - RX,TX, Mode, Baud
    XB.AT_Init                     ' Initialize for fast AT command use - 5 second delay to perform
    num.init                       ' Initialize Numbers object

Repeat Value from 150 to 200                                                                                              
  XB.Dec(Value)
  XB.tx(13)
  waitcnt(clkfreq / Hz + cnt) 
  
Repeat Value from 200 to 100              
  XB.Dec(Value)
  XB.tx(13)  
  waitcnt(clkfreq / Hz + cnt) 

Repeat Value from 100 to 150              
  XB.Dec(Value)
  XB.tx(13)  
  waitcnt(clkfreq / Hz + cnt)



And the receiver:

''*****************************************************
''*  XBee RF Receiver Example                         *
''*  Uses XB24 to receive a byte at a time            * 
''*  Author: Ken Gracey                               *
''*  Date: November 2009                              *
''*****************************************************

CON
  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000
  Hz       = 100 
   
VAR

  long   range
  long   value
  long   loopcounter

OBJ

  Serial : "FullDuplexSerial"        
  Debug  : "FullDuplexSerialPlus"
  HB25   : "HB-25"
  XB     : "XBee_Object"
  Num    : "Numbers"
 
PUB Start | check
    XB.start(24,25,0,9600)          ' XBee Comms - RX,TX, Mode, Baud
    HB25.config(7,1,1)   
    Debug.startPST(9600) 
    XB.AT_Init                      ' Initialize for fast AT command use - 5 second delay to perform
    num.init                        ' Initialize Numbers object
    loopcounter := 1

Repeat
  loopcounter := loopcounter + 1
  debug.dec(loopcounter)
  debug.carriagereturn
  if XB.RxCheck    
    value := xb.rx
  debug.dec(value)
  debug.carriagereturn

Post Edited (Ken Gracey (Parallax)) : 10/29/2009 5:07:56 PM GMT

Comments

  • Ken GraceyKen Gracey Posts: 7,401
    edited 2009-10-29 17:16
    I'm pretty sure that my problem lies in this information from the manual:

    Transparent Operation
    When operating in transparent mode, the modules act as a serial line replacement. All UART data
    received through the DIN pin is queued up for RF transmission. When RF data is received, the data
    is sent out through the DOUT pin. The module configuration parameters are configured using the
    AT command mode interface.
    Data is buffered in the serial receive buffer until one of the following causes the data to be
    packetized and transmitted:
    • No serial characters are received for the amount of time determined by the RO (Packetization
    Timeout) parameter. If RO = 0, packetization begins when a character is received.
    • The Command Mode Sequence (GT + CC + GT) is received. Any character buffered in the
    serial receive buffer before the sequence is transmitted.
    • The maximum number of characters that will fit in an RF packet is received.
    RF modules that contain the following firmware versions will support Transparent Mode:
    20xx (AT coordinator), 22xx (AT router), and 28xx (AT end device).

    Particularly confusing to me is that the manual says "The XBee modules support both transparent and API (Application Programming Interface) serial interfaces." However, in the same page (excerpt above) is the statement that only certain firmware versions will support transparent mode. So I checked my firmware and it's not one of the transparent mode versions. My firmware is 1084, yet the last bullet from the manual says that only 20xx, 22xx and 28xx support transparent mode.

    Thanks,

    Ken Gracey
    Parallax Inc.attachment.php?attachmentid=64764

    Post Edited (Ken Gracey (Parallax)) : 10/29/2009 5:29:02 PM GMT
    455 x 587 - 81K
  • sylvie369sylvie369 Posts: 1,622
    edited 2009-10-29 17:51
    Ken Gracey (Parallax) said...
    I'm pretty sure that my problem lies in this information from the manual:

    Particularly confusing to me is that the manual says "The XBee modules support both transparent and API (Application Programming Interface) serial interfaces." However, in the same page (excerpt above) is the statement that only certain firmware versions will support transparent mode. So I checked my firmware and it's not one of the transparent mode versions. My firmware is 1084, yet the last bullet from the manual says that only 20xx, 22xx and 28xx support transparent mode.
    Hmm. Are these Series 2 (2.5, whatever) XBees? I've been using Series 1 XBees for a couple of years, and have never touched the API mode, and my firmware is 10XX (something - I think it's 1084 currently). Series 1 XBees, at least, certainly do not need 2XXX level firmware to use the non-API (transparent) mode. I do think it's quite possible that things are different for Series 2 (2.5...) XBees, though.

    I did unsuccessfully try to read data received by an XBee into a Propeller a couple of months ago. I didn't have time to really dig into it, but I didn't ever get it working, despite confirming as you did that the XBee was receiving properly.
  • Ken GraceyKen Gracey Posts: 7,401
    edited 2009-10-29 19:02
    sylvie369 -
    These are model XB24, function set 802.15.4, and version 10E6.

    Therefore, it seems that we have similar firmware. Sounds like you got stuck at the same place as me in the past: PC reception is good but not via a Prop. Hmm. I'll take a look at Martin Hebel's book in the meantime.

    Thanks, Ken Gracey
  • SRLMSRLM Posts: 5,045
    edited 2009-10-29 19:46
    I was stuck there too... Haven't gone back yet. Maybe you can draw some insight and come up with the solution?

    http://forums.parallax.com/showthread.php?p=814317
  • Ken GraceyKen Gracey Posts: 7,401
    edited 2009-10-29 19:54
    Just a quick update to those about to help me: PROBLEM SOLVED! I spent one of my "tech support tickets" with a call to Phil Pilgrim. Amazing how a smart guy like Phil can get a half-smart monkey to understand something over his head. Within five minutes he had sorted out my problems - I was sending decimal and displaying ASCII. Now that my problem is solved I will post the finished (ahem, working at least) code here for future XBee troublemakers.

    I can see that Parallax has a bunch of work to provide some working examples for these little XBee critters.

    BTW, we are going to stock them really soon.

    Ken Gracey
    Parallax Inc.
  • Ken GraceyKen Gracey Posts: 7,401
    edited 2009-10-29 20:31
    Okay, the attached two programs successfully send a few bytes from one Prop to another, and display on PST.

    Our engineers will scold me for posting such raw programs. There's certainly some room for improvement, but this got me started.

    Ken Gracey
    Parallax Inc.
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-30 03:36
    Congratulations Ken (and Phil for the help). Sometimes it is the simple things that take the longest time to resolve - usually looking for a complex solution LOL

    These modules would be great for stocking. And now you have something running smile.gif

    BTW Nothing wrong with the code you posted... Clear and simple !

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2009-10-30 13:16
    Ken,
    Glad you got it worked out, but I think I told you in my Email you were sending DEC's are trying to receive characters... Sorry if my Email wasn't clear enough on that :P

    After an accident I'm working one handed for a while, so my Emails have been a little short worded.

    -Martin
  • sylvie369sylvie369 Posts: 1,622
    edited 2009-10-30 17:08
    Martin Hebel said...
    Ken,
    Glad you got it worked out, but I think I told you in my Email you were sending DEC's are trying to receive characters... Sorry if my Email wasn't clear enough on that :P

    After an accident I'm working one handed for a while, so my Emails have been a little short worded.

    -Martin
    Oh no! I hope everything is going to be okay. The world of XBee users needs a healthy Martin.

    My best wishes.
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2009-10-30 19:31
    Thanks, I'll be fine. Just not up to soldering any boards together anytime soon!
Sign In or Register to comment.