Shop OBEX P1 Docs P2 Docs Learn Events
xbee issue please help — Parallax Forums

xbee issue please help

synapsesynapse Posts: 19
edited 2010-12-19 14:44 in Accessories
ok So I am using the Xbee api object XB : "XBee_Object" with my propeller.

All is going great I can transmit all the data I want from the propeller to the pc using the xbee usb adapter and the like. however now I want to send commands to the propeller and do a XB.rx or the like but to no avail. I have spent the last 16 hours racking my brain even submitted a support ticket with parallax but haven't heard back yet. but it is Friday so I will give them that.

Sorry for the poor typing my hands are falling asleep. I have this huge Concept that all hinges on my ability to send data back and forth wirelessly to my propeller. I can use fullduplexserial and it works great but the xbee wont receive. I have to be missing something. they are series 1 pro boards at 63uW.

here is the code I am using now to test around the problem. I even downloaded a few c# libs thinking maybe I am not sending some AT command from the PC I should be. : (btw the getpresure sub doesn't matter it does the same with or without it. )
CON
  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000

  'Serial
  SerialComBaud = 9600
  CR = 13
  LF = 10

  XBRX = 17
  XBTX = 16
  
  'SCP1000D0
  SCP_DRDY      =11                                       ' SHT DRDY pin
  SCP_CSB       =7                                       ' SHT CSB  pin
  SCP_MISO      =8                                       ' SHT MISO pin
  SCP_MOSI      =9                                       ' SHT MISI pin
  SCP_SCK       =10                                       ' SHT SCK pin

  'H48C 3axis Accelerometer
  CS = 13
  DIO = 15
  CLK = 14

   
OBJ
  SerialCom     : "FullDuplexSerial"                                                         'Cogs 1
  SCP           : "SCP1000D0"                                                                'Cogs 0
  FloatString   : "FloatString"                                                              'Cogs 0
  FloatMath     : "FloatMath"                                                                'Cogs 0
                                                                                 'This object Cogs 1
                                                                                       'Cogs used: 2
  S   : "STRINGS2"
  XB            : "XBee_Object"
  sdfat         : "fsrw"
  H48C  :     "H48C Tri-Axis Accelerometer"
     
VAR
   byte tbuf[20]
   byte bigbuf[8192]
   long vref,x,y,z,ThetaA,ThetaB,ThetaC
   long rxchk
   long a,b,c  
   long stra[1] 
  long frame[400]                                                                                                                                                                    
PUB main
  Init
  XB.str(string("Ready:"))
  XB.CR
  repeat
    rxchk:= SerialCom.rxcheck ' this was XB.rxcheck
    ifnot rxchk==-1
      b := SerialCom.Rx ' this was XB.rx
      if  b== "0"
        XB.str(string("AXON OS version 1.0"))
       CRLF
      if  b== "1"
        XB.dec(1)
      if  b== "2"
        XB.dec(2)
      if  b== "3"
        GetPresure      
      ELSE   
        CRLF    
          
    'GetPresure
'  sdfat.pclose
  writeStringData(string("SDWrite Complete!"))
  CRLF   


  
PRI CRLF
  XB.CR
  XB.Tx(10)

PRI writeStringData(strd)
  XB.str(strd)
  sdfat.SDstr(strd)
PRI writeBinData(bind,len)
  XB.bin(bind,len)
  sdfat.sdbin(bind,len)
PRI writeDecData(decd)
  XB.dec(decd)
  sdfat.SDdec(decd)
  

    
    
      
PRI Init  |r
  'Serial
  SerialCom.start(31,30,0,SerialComBaud)
  XB.start(XBRX,XBTX,0,SerialComBaud)
  XB.AT_Init                     ' Initialize for fast AT command use - 5 second delay to perform
  XB.AT_ConfigVal(string("ATMY"),$5) ' Set MY address to 5
  
  'Math
'  FloatMath.start                                  ' start floating point object
  'SCP1000D0
  
  writeStringData(string("Init Pressure Sensor"))
  CRLF
  SCP.start(SCP_DRDY, SCP_CSB, SCP_MISO, SCP_MOSI, SCP_SCK) ' start SCP object
  writeStringData(string("Pressure Sensor Init Complete"))
  CRLF
    'start and setup Accelerometer
  writeStringData(string("Init H48C Sensor"))
  CRLF
  H48C.start(CS,DIO,CLK)
  writeStringData(string("H48C Init Complete"))
  CRLF
    'writeStringData(string("Mounting SD Card"))
  CRLF
  sdfat.mount(0)
  writeStringData(string("Mounted SD Card"))
  r := sdfat.popen(string("telem.txt"), "w")
  CRLF 

Comments

  • JimInCAJimInCA Posts: 80
    edited 2010-12-18 08:25
    I had a very similar issue. I’m using the Propeller ASC with a Sparkfun XBee Wireless Shield. The shield had a diode in series with the XBee Din pin. I replaced the diode with a 0 ohm resistor and then everything worked perfectly. I don’t know if yours is a similar issue, but is sounds exactly like was I was seeing with my setup.
    Jim…
  • synapsesynapse Posts: 19
    edited 2010-12-18 10:49
    A 0 ohm resistor? I have that it is just a wire or was that a typo?
  • JimInCAJimInCA Posts: 80
    edited 2010-12-18 11:10
    It was no typo. They do make 0 ohm resistors. But a piece of wire will work as well.
    Jim...
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2010-12-19 05:58
    I've test the code without the unneeded objects, since I'm not set up for that, but the code using XB. or SerialCom works identical.

    Every other time I enter a 0, on the USB XBee I get your string, or every other value I see the values (1,2,3) on the USB terminal.

    In your code you do change the MY addr of the Prop XBee to 5. Are you setting the USB XBee to send to a DL of 5 so it sends data to the correct address?

    -Martin
  • synapsesynapse Posts: 19
    edited 2010-12-19 10:14
    I've test the code without the unneeded objects, since I'm not set up for that, but the code using XB. or SerialCom works identical.

    Every other time I enter a 0, on the USB XBee I get your string, or every other value I see the values (1,2,3) on the USB terminal.

    In your code you do change the MY addr of the Prop XBee to 5. Are you setting the USB XBee to send to a DL of 5 so it sends data to the correct address?

    -Martin

    OK I guess my question then is how on the pc through the terminal do I send text to a specific address? If that is it this will solve so many issues.
    Thanks,
    Terry Massey
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2010-12-19 11:08
    You can read through Chapter 3 of the XBee tutorial for both command line configuration or using X-CTU software posted in the forums, but here's the short and sweet:

    - Easiest thing to do is take the "ATMY" code out of your project. That will keep both on the default address (source and destination) of 0.

    - To change your USB XBee to send to an address of 5:
    --- To enter Command Mode, in the terminal window, wait 3 seconds
    --- type +++
    --- wait until it says OK (takes a couple seconds)
    --- To set destination address to 5, type ATDL 5 & hit enter
    --- it says OK
    --- To save this, so that cycling power doesn't change it, type ATWR & hit enter
    --- Type ATCN to exit command mode

    You should be good to go.
    -Martin
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2010-12-19 11:11
    If you change your code for the MY address, be sure to cycle power to reset to default after downloading, or simply change the ATMY value to 0 in code.
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2010-12-19 11:23
    If you do use ATWR to save your configuration, you can restore to default using ATRE, then ATWR to save again.
  • synapsesynapse Posts: 19
    edited 2010-12-19 12:28
    That worked great thanks you are a saint!!!!!!!!!!!!!!!!!!!!!!!
    You can read through Chapter 3 of the XBee tutorial for both command line configuration or using X-CTU software posted in the forums, but here's the short and sweet:

    - Easiest thing to do is take the "ATMY" code out of your project. That will keep both on the default address (source and destination) of 0.

    - To change your USB XBee to send to an address of 5:
    --- To enter Command Mode, in the terminal window, wait 3 seconds
    --- type +++
    --- wait until it says OK (takes a couple seconds)
    --- To set destination address to 5, type ATDL 5 & hit enter
    --- it says OK
    --- To save this, so that cycling power doesn't change it, type ATWR & hit enter
    --- Type ATCN to exit command mode

    You should be good to go.
    -Martin
  • synapsesynapse Posts: 19
    edited 2010-12-19 12:32
    how did I miss page 42 that was what I was looking for. ahhhh
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2010-12-19 14:44
    No problem, nice to see someone working with Remote monitoring and control!
Sign In or Register to comment.