Thread: Serial port programming in Linux

  1. #16
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    http://www.stat.ucla.edu/cgi-bin/man-cgi?termios
    Look at the bits which talk about XON and XOFF (for software control)
    Look at the bits which talk about CTS and RTS (for hardware control)

    Remember, you need a fully wired serial cable for hardware control.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #17
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Didn't work also. BTW, in minicom, I set the software and hardware control to "NO". So I guess it means that it didn't use flow control at all. BTW, when I asked the person who make the device, he said that he built it to be an asynchronous NULL modem.

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well then you have a problem then, if neither form of flow control is implemented.

    It's "fine" if you use it at human typing speed (a few chars per second), but if you send a huge block at program speed, then the link is swamped, data is lost and you're in the dark.

    Testing is like pouring cold water into a chocolate teapot and saying that it works.
    Your hardware designer has built and tested a cold water teapot, and you're coming along with hot water.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #19
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    I see. Guess I have no choice but to have a discussion with the hardware programmer. But why does if I tried it in minicom it worked without any flow control? How does minicom work? Does it send the message one char at a time everytime it recognized a key press?

    Thanks a lot.

  5. #20
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > But why does if I tried it in minicom it worked without any flow control?

    > Bps / Par / Bits : 4800 8N1
    Because you can't type at 500 characters per second would be my guess.

    Whereas your code has absolutely no trouble maintaining a rate of 500 chars per second.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #21
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Quote Originally Posted by Salem

    Whereas your code has absolutely no trouble maintaining a rate of 500 chars per second.
    Ahh, that makes sense. And I thought minicom sends the message after I hit "Enter". Silly me. Thanks for clearing that up.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. serial port to poll on request
    By infineonintern in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 06:52 AM
  2. Linux serial port interrupts
    By danga1993 in forum Linux Programming
    Replies: 1
    Last Post: 04-28-2007, 11:15 AM
  3. Serial port programming in Linux
    By g4j31a5 in forum C++ Programming
    Replies: 1
    Last Post: 09-28-2006, 08:24 PM
  4. need guidance to connect to serial port
    By gnychis in forum Linux Programming
    Replies: 1
    Last Post: 06-02-2005, 10:10 AM
  5. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM