title: Python script to configure an XBee module fails on a raspberry pi
body: <p>I have a python script that I want to use to configure some XBee modules. It works perfectly find when connect to a computer via an <a href="http://microframework.dk/post/XBee-RF-module-specifications.aspx" rel="nofollow">xbee development board</a>, but fails when connect to a raspberry pi via the slice of pi board.</p>
  
  <p>I have narrowed down the problem to it failing to enter the command mode, after sending the +++ the xbee never sends the OK message. Here is the relevant code:</p>
  
  <pre><code>...
  CC = '+'
  GT = '1.1' # Tried different values here
  ...
  
  def startCommandMode(self):
      self.emptyBuffer() # Tried with and without this line
      sleep(self.GT) # Tried with and without this line
      self.ser.write(self.CC + self.CC + self.CC)
      sleep(self.GT)
      return self.getReply() == 'OK'
  
  ...
  
  def getReply(self):
      count = 0
      reply = ''
      while True:
          char = self.ser.read()
          if char == '\r':
              break
          if len(char) == 0:
              return None
          reply += char
  
      return reply
  </code></pre>
  
  <p>The full source is available on <a href="https://github.com/james147/xbee-config/blob/master/xbee-config.py" rel="nofollow">github</a> if needed.</p>
  
  <p>I know it is not a problem with the xbee module, the raspberry pi or the slice of pi board as it works perfectly fine if I try it manually using "picocom -lc /dev/ttyAMA0".</p>