Loading ...
Sorry, an error occurred while loading the content.
 

processing speed and serial I/O throughput

Expand Messages
  • Paul King
    Looking into the CMUCam raw data processing issues got me thinking about the IntelliBrain s processing power with regard to serial I/O. My measurement of a
    Message 1 of 2 , Oct 3, 2008
       
      Looking into the CMUCam raw data processing issues got me thinking about the IntelliBrain's processing power with regard to serial I/O.
       
      My measurement of a for-loop is that an empty for loop makes 10,000 iterations per second.  If a single floating point multiply is added, that drops to 5,000 iterations per second.
       
      A serial port running full-throttle at 115.2 kbps will generate 11,000 characters per second.  This would seem to be substantially beyond the JVMs ability to keep up while processing the characters one at a time, since a test shows that calling available() on the serial port can be done at a rate of at most 2,000 times per second. 
       
      This led me to wonder how the IntelliBrain's serial I/O is implemented.  Is the driver for this written in C or assembly to keep up with the full baud rate of 115.2 kbps?
       
      The documentation for InputStream.available() says that it always returns 0, which means there is no way to read all characters currently available in a single step into a buffer.  Is it really true that available() always returns 0 for the serial port?
       
      In any case, it looks as though the practical limit for serial communications is going to be closer to 9600 baud, or maybe 19,200 baud, except for bursts of transmission that would be captured by the 64 character buffer.  Does that sound about right?
       
      Best,
      Paul
       
    • RidgeSoft
      Hi Paul, The serial port routines are implemented in C code in the virtual machine. At the lowest layer there are interrupt service routines moving characters
      Message 2 of 2 , Oct 3, 2008
        Hi Paul,

        The serial port routines are implemented in C code in the virtual
        machine. At the lowest layer there are interrupt service routines
        moving characters between buffers and the UART registers. The block
        read method for the serial port is implemented as a native method in
        C. The copy from the virtual machine buffer to the Java byte array
        is done in C. All reads from Java are handled as block reads. If
        you use the single character version of read it fetches the character
        via the block read method. With the block read method and a 32 byte
        buffer the Java code would have to invoke the read method
        approximately 350 times per second to keep up with 115.2K baud. This
        sounds feasible, but we haven't tested to see what the maximum
        sustained throughput of the serial port is. However, as you mention,
        analyzing this volume of data in real-time would be quite a
        challenge. But that's the value of the CMUcam. It is designed to do
        the analysis and only communicate the results to robot controller.

        Regards,

        RidgeSoft Support

        --- In intellibrain@yahoogroups.com, "Paul King" <email@...> wrote:
        >
        >
        > Looking into the CMUCam raw data processing issues got me thinking
        about the IntelliBrain's processing power with regard to serial I/O.
        >
        > My measurement of a for-loop is that an empty for loop makes 10,000
        iterations per second. If a single floating point multiply is added,
        that drops to 5,000 iterations per second.
        >
        > A serial port running full-throttle at 115.2 kbps will generate
        11,000 characters per second. This would seem to be substantially
        beyond the JVMs ability to keep up while processing the characters
        one at a time, since a test shows that calling available() on the
        serial port can be done at a rate of at most 2,000 times per second.
        >
        > This led me to wonder how the IntelliBrain's serial I/O is
        implemented. Is the driver for this written in C or assembly to keep
        up with the full baud rate of 115.2 kbps?
        >
        > The documentation for InputStream.available() says that it always
        returns 0, which means there is no way to read all characters
        currently available in a single step into a buffer. Is it really
        true that available() always returns 0 for the serial port?
        >
        > In any case, it looks as though the practical limit for serial
        communications is going to be closer to 9600 baud, or maybe 19,200
        baud, except for bursts of transmission that would be captured by the
        64 character buffer. Does that sound about right?
        >
        > Best,
        > Paul
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.