4 Replies Latest reply on Jul 7, 2016 3:23 AM by TonyMontes

    Question: Data Buffering using UPM XBee libraries

    TonyMontes

      Hi!,

      I am running a code where the Edison is alternating between retrieving/sending data on the XBee interface and reading from a database. The code is sequential so, while it is reading on the database some data may arrive on the XBee, that supposedly would be lost. The data buffer on the XBee module is 202 bytes long. The modules are it AT mode with no flow control activaded.

       

      However, after testing to send data chunks over 202 bytes, up to 1024. The XBee listening function is using a 200ms timeout and capturing the data chunks up to 1024 bytes.  it seems that it always catches the whole data stream without truncating the data chunk. This makes me wonder how this is happening, if there is actually some extra buffering going on or it is all due to the 200ms timeout in the ReadXBee function. (in the UPM example is 1000)

      public static String ReadXBee (){
      String response=""; 
       if (sensor.dataAvailable(200)){
        response=sensor.readDataStr(1024); //reads available data and puts it into string, the call blocks until data is available
       }
      return response; 
      }
      

       

      Any ideas please?