Re: 8ms Timer for serial port access

From: Jens Schumacher (jens.schumache_at_gmx.net)
Date: 10/29/03

  • Next message: Grant Edwards: "Re: 8ms Timer for serial port access"
    Date: Tue, 28 Oct 2003 20:52:47 -0500
    
    

    Thank you all for your answers.
    I think I'll have to rewrite my driver first and use your suggestions. Seems
    that I really make it harder than it is.

    Just some questions left...

    >> I meet some Problems when I tried this. I tried to read the
    >> data and checked how many bytes were read. When I had less
    >> than 24 I read again and asked for the missing bytes. But
    >> somehow some bits were corrupt and gave me wrong numbers.
    >
    > Then the baud rate is wrong, or the parity is wrong, or you're
    > out-of-sync with the frame boundaries, or something else is
    > wrong.

    Baud rate is definitely correct, parity to and I check the frame boundaries
    with a frambit which is one at the beginning of every frame. Don't know
    what's wrong there...I will double check this with my reimplementation.

    > By default, a read() will block if there is no data available.
    > If you want to have a timeout on the blocking, use select() or
    > poll().

    Does read() block until it read as many bytes as defined in the function
    call or just blocks until it read some bytes, no matter how many? Couldn't
    find information about this in man.

    > Don't delay. Don't call usleep(). Just call select/poll to
    > wait for data or call read() in blocking mode (which is the
    > default). Then just process the data stream as it arrives.

    I will try this. Should I rather use select/poll than read()? Are there any
    advantages?

    Just one last question:
    Any suggestions how to get the data to from the "serial port object" to the
    "application object". I like to keep them as separated as possible...this is
    why I triggered a timer in the "application object" to get the data
    available in the "serial port object".

    And again thank you very much I'm very grateful for your help offered to me.

    Jens Schumacher


  • Next message: Grant Edwards: "Re: 8ms Timer for serial port access"