serial port programming

Jean-Marc Francois francois at run.montefiore.ulg.ac.be
Mon Nov 24 09:29:32 PST 2003


Sir,


I've posted this question on a newsgroup, but got no response.
Is there a cuaa-guru out there ? :-)

Thanks !
Jean-Marc Francois
Université de Liège

---------------
I got a strange problem.

I want to send a binary string to a small device I made via /dev/cuaa0.
The port settings should be 19200, 8N1 (no RTS/CTS, no XON/XOFF).  Looks simple.

I've written a small program using the standard POSIX API : tcgetattr and the like.

When I launch my program, it doesn't work (well, it works with Linux but not with FreeBSD).
If I first launch minicom (and ask it to setup the serial port), let it in the
background and launch my program, it works.

The problem is that the dump of the 'stuct termios' my program is using with or without
minicom is the same, so that's not the problem (stty -f /dev/cuaa0 gives the same output
also).

I thought all the serial settings were in this structure; where am I wrong ?


Thank if you can help (if you can't, thanks for reading anyway :-) ),
JM

---
#> stty -f /dev/cuaa0
speed 19200 baud;
lflags: -icanon -isig -iexten -echo
iflags: -icrnl -ixon -ixany -imaxbel ignbrk -brkint
oflags: -opost -onlcr -oxtabs
cflags: cs8 -parenb clocal
time
5

---
Dump of struct termios :

c_iflag : 0x1
c_oflag : 0x0
c_cflag : 0xcb00
c_lflag : 0x0
c_cc[0] : 0x4
c_cc[1] : 0xff
c_cc[2] : 0xff
c_cc[3] : 0x7f
c_cc[4] : 0x17
c_cc[5] : 0x15
c_cc[6] : 0x12
c_cc[7] : 0x8
c_cc[8] : 0x3
c_cc[9] : 0x1c
c_cc[10] : 0x1a
c_cc[11] : 0x19
c_cc[12] : 0x11
c_cc[13] : 0x13
c_cc[14] : 0x16
c_cc[15] : 0xf
c_cc[16] : 0x1
c_cc[17] : 0x5
c_cc[18] : 0x14
c_cc[19] : 0xff
c_ispeed : 0x4b00
c_ospeed : 0x4b00

---
---------------



More information about the freebsd-questions mailing list