Find the answer to your Linux question:
Results 1 to 5 of 5
HI again (from the cofee lounge). I plan to use RS232 serial port control lines (RTS, CTS, CDC, RI, DSR...) to read and write logical levels from the outside world. ...
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    3

    Serial port registers HOWTO

    HI again (from the cofee lounge).
    I plan to use RS232 serial port control lines (RTS, CTS, CDC, RI, DSR...) to read and write logical levels from the outside world. This is for controling an external electronic device.
    The problem now is that I have no clue how to read and write the 16550 registers as it seems that they are handled by the kernel.
    Programming is in C++ .
    I would appreciate any usefull suggestion about this.
    Thank you.
    Joss.

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Looks like it's time for you to write a device driver, so google this:
    Code:
    Linux "device driver" tutorial
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Sep 2008
    Posts
    3
    Hmm. You mean that it is not possible to program the UART through the kernel. Look gtkterm, a small terminal software like Hyper Terminal or Procomm, with this software you can configure line speed, thus gtkterm changes the content of the LCR (Line Control Register). This is exactly what I want to do exept that I want to talk with MSR and MCR, that are just differnents (but very close) IO ports.

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    with this software you can configure line speed
    Yes. One can write a user application in C which configures line speed (transmission rate), bits per byte, parity (even/odd/off), number of stop bits and enabling/disabling hardware flow control, and which sends and detects break. That's why gtkterm could be written to do these things. For information on how to do that in C, do this at the command line:
    Code:
    man tcsetattr
    But you want to do other things directly. I'm thinking that writing a driver might be the easiest way to do them.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  5. #5
    Just Joined!
    Join Date
    Sep 2008
    Posts
    3
    Sorry for delay before reply, I've been a few days off
    Ok for your post but I have data concerning tcsetattr, but I have found some usefull information about functions included in <termios.h> in another forum, I will try some lines of code and will let you informed.
    Thanks for the tip.
    Joss.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...