RS232 Buffer size

By GadiK ยท 5 replies
Jan 27, 2008
  1. Hi guys,
    I'm working with a GPS and other devices that use serial communication.
    I need to know what is the recieving buffer size set in Windows for the Serial Port.
    Where do I find this magical number?

    I've googled this and I found that some say its 4096 bits and others refer to the registry entry LOCAL MACHINE->HARDWARE->SYSTEM->CURRENTCONTROLSET->SERVICES->SERIAL: There you find the TxFIFO which values at 0x0e=14. What does this mean?

    Thank You...
  2. raybay

    raybay TS Evangelist Posts: 7,241   +10

    We are not talking about big numbers here. There is information on this topic on the Garmin site.
    The GPS just isn't sending that much data... 64 bytes is adequate, but 1024 should be plenty. You want multiples of 64. Make the first read a minimum size, round up to the next multiple of 64 bytes and then read the rest of the transaction. Remember that the device does not know how big the buffer is, so it will send reads until it runs out of data... causing an overrun.
    If you are concerned about a BulkRead() error, it will return either because the buffer was full or there was a short packet.
    Check check the actual size returned to discover the amount of data transferred, then you handle the overflow.
    This is really a flaw of some Garmins, but if you are merely trying to avoid the error message, it is simple. Check the help sections of Garmin.
  3. GadiK

    GadiK TS Rookie Topic Starter

    I'm actually not worried about the GPS, but about another device that we are building here in BGU (University in Isarel). This device measures data and sens it through a serial com. We want to know what the buffer size is so to configure our device accordingly.
    Where is this number located??
    I'm trying to use the GetDefaultCommConfig() function but i'm having trouble with it. Anyone has a link to an example or something?
  4. GadiK

    GadiK TS Rookie Topic Starter

    I've moved to the GetCommProperties() function.
    When I debug the program it gives an "unhandled exception" message.
    my code:

    /* setup for the serial port, including Ins_SerCom.Open("COM8");
    /* COM8 is my serial port
    /* also i declared: LPCOMMPROP *port_232

    GetCommProperties(Ins_SerCom.hCom, *port_232);
  5. jobeard

    jobeard TS Ambassador Posts: 11,138   +985

    I think you'r working too hard on this. RS232 links perform best with an MTU of 576.
    Leave the rest alone.

    Why 576? Serial links are notoriously noisy and thus have frequent retries.
    It's better to get many short blocks successfully and NAK one in error than
    to get 90% through a large block and keep NAK it.

    Also google for the tcp Sackopts to improve performance.

    btw: this is a networking question, not Windows.
  6. GadiK

    GadiK TS Rookie Topic Starter

    OK, got it!! LPCOMMPROP is a type of pointers to COMMPROP structures.
    So no need for the * at declaration.

    I ran the function and from the COMMPROP structure I pulled the "dwCurrentRxQueue" number wich was 68992 bytes.

    Thanks for the help guys!!! :)
Topic Status:
Not open for further replies.

Similar Topics

Add your comment to this article

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...