public inbox for gentoo-embedded@lists.gentoo.org
 help / color / mirror / Atom feed
From: Daniel Stonier <d.stonier@gmail.com>
To: gentoo-embedded@lists.gentoo.org
Subject: Re: [gentoo-embedded] serial port handling question
Date: Thu, 14 Jan 2010 11:56:14 +0900	[thread overview]
Message-ID: <27dfa3d1001131856u29a0b5e0s82001c90956b27c@mail.gmail.com> (raw)
In-Reply-To: <20100113185240.4bc9d721@osage.osagesoftware.com>

I've never actually used the RTS on - always had it off. But just in
case you didn't find the details there's a setting in the termios
options structure for rts - have you tried that?

'man termios' - look for CRTSCTS.

I usually use a bit of code to set the flag off for my connections:

*******************************

termios options;
// Disable Flow control
#if defined(CRTSCTS)
    options.c_cflag &= ~CRTSCTS; // Disable hardware flow control (old)
#elif defined (CNEW_RTSCTS)
    options.c_cflag &= ~CNEW_RTSCTS; // Disable hardware flow control (new)
#endif
tcsetattr(file_descriptor,TCSAFLUSH,&options);

*******************************

Above, file_descriptor is the handle you get back from the previously
called open(...).

2010/1/14 David Relson <relson@osagesoftware.com>
>
> G'day,
>
> I'm porting some old DOS code to Linux for a medical device that is
> being upgraded.  Among other goodies, it has a sensor that sends data at
> 115KB to an onboard NS16550A (or equivalent).
>
> The sensor is controlled (in part) by setting RTS on and off. I looked
> high and low (pun intended) for an ioctl or similar call that would
> allow this level of control and couldn't find anything. I finally ended
> up using the ollowing lines of code:
>
>  outb(inportb(MCR) |  0x02, MCR);  //DTR,RTS=ON
>  outb(inportb(MCR) & ~0x02, MCR);  //DTR=ON,RTS=OFF
>
> Directly tweaking the I/O port runs against the grain, but it's the
> only thing I've found that works.
>
> Is there a better way to control the chip?
>
> Regards,
>
> David
>



--
Phone : +82-10-5400-3296 (010-5400-3296)
HomePage: http://snorriheim.dnsdojo.com/
Yujin Robot: http://www.yujinrobot.com/
Projects: http://snorriheim.dnsdojo.com/redmine/projects
Embedded Control Libraries: http://snorriheim.dnsdojo.com/redmine/wiki/ecl



  parent reply	other threads:[~2010-01-14  2:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 23:52 [gentoo-embedded] serial port handling question David Relson
2010-01-14  2:55 ` Peter Stuge
2010-01-14  4:30   ` David Relson
2010-01-14  5:08     ` Peter Stuge
2010-01-14 10:53       ` Peter Bell
2010-01-14  2:56 ` Daniel Stonier [this message]
2010-01-14  3:47   ` Peter Stuge
2010-01-14  4:09     ` David Relson
2010-01-14 10:05 ` Bob Dunlop
2010-01-14 12:29   ` David Relson
2010-01-14 16:17     ` Peter Stuge
2010-01-14 16:21       ` Relson, David
2010-01-14 16:29         ` Peter Stuge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27dfa3d1001131856u29a0b5e0s82001c90956b27c@mail.gmail.com \
    --to=d.stonier@gmail.com \
    --cc=gentoo-embedded@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox