You are not logged in.

#1 2008-12-28 19:09:50

yehdev_cc
Member
Registered: 2008-06-03
Posts: 26

Interfacing UART

Hi,
First, I'm sorry if this isn't the right forum for this topic, but I thought it has to do with programming...
The problem is that I need to interface a UART to my PC through a serial port, but I don't know exactly how should  I do this...
should I read directly from /dev/tty for example ? or should I write a linux kernel module to handle this ?
I don't know much about how linux organize hardware/drivers interactions, so where should I start ?
Can any one please suggest a procedure.. ? or may be a link ? I'd be grateful ...
thanks in advance..

Offline

#2 2008-12-28 21:40:25

bboozzoo
Member
From: Poland
Registered: 2006-08-01
Posts: 125

Re: Interfacing UART

Could you describe in more details what kind of 'interaction' do you expect?

Some time ago I wrote a small tool for measuring one-way traffic delay which used serial line for distributing clock reference (due to sort of known delay). The tool sent packed structure containing clock reference information, thus 'raw' mode was used.
Basically it looked like this:
1. open /dev/tty (this was passed as command line param eg. /dev/ttyS0, the pc had multi port cards - moxxa etc)
2. tcgetattr
3. cfmakeraw
4. cfsetospeed (cfsetifspeed on client)
5. tcsetattr
6. read/write

Offline

#3 2008-12-28 22:06:00

yehdev_cc
Member
Registered: 2008-06-03
Posts: 26

Re: Interfacing UART

bboozzoo wrote:

Could you describe in more details what kind of 'interaction' do you expect?

Some time ago I wrote a small tool for measuring one-way traffic delay which used serial line for distributing clock reference (due to sort of known delay). The tool sent packed structure containing clock reference information, thus 'raw' mode was used.
Basically it looked like this:
1. open /dev/tty (this was passed as command line param eg. /dev/ttyS0, the pc had multi port cards - moxxa etc)
2. tcgetattr
3. cfmakeraw
4. cfsetospeed (cfsetifspeed on client)
5. tcsetattr
6. read/write

Thank you for your reply..
I forgot to say that I'm using C/C++ ..
OK, about the 'interaction' thing, I was just seeking a better and in depth understanding of how linux organize these things..
I want to make a circuit that uses UART to communicate with the serial port in my PC to send data at relatively higher rates..
So, I wanted to know if I can use /dev/ttys directly or should I find alternative more cutomizable way..
I found some useful information in 'Advanced Linux Programming' book about 'ioctl', I'll be looking there, otherwise, I'll have to go into more in depth reading in "Linux Device Driver 3' ...

Offline

Board footer

Powered by FluxBB