From owner-freebsd-questions@FreeBSD.ORG Wed Dec 3 19:06:21 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D435016A4CE for ; Wed, 3 Dec 2003 19:06:21 -0800 (PST) Received: from sis1.snu.ac.kr (sis1.snu.ac.kr [147.46.10.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5159043FE3 for ; Wed, 3 Dec 2003 19:06:20 -0800 (PST) (envelope-from lahaye@snu.ac.kr) Received: from snu.ac.kr ([147.46.44.183]) by sis1.snu.ac.kr (8.12.10/8.12.10) with ESMTP id hB4343pl295646; Thu, 4 Dec 2003 12:04:05 +0900 Message-ID: <3FCEA4A9.4010205@snu.ac.kr> Date: Thu, 04 Dec 2003 12:06:17 +0900 From: Rob Lahaye User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031104 X-Accept-Language: en-us, en MIME-Version: 1.0 To: francois@montefiore.ulg.ac.be, freebsd-questions@freebsd.org References: <3FC23FE2.5010101@run.montefiore.ulg.ac.be> In-Reply-To: <3FC23FE2.5010101@run.montefiore.ulg.ac.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: serial port programming X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2003 03:06:21 -0000 X-List-Received-Date: Thu, 04 Dec 2003 03:06:21 -0000 Jean-Marc Francois wrote: > Sir, > > > I've posted this question on a newsgroup, but got no response. > Is there a cuaa-guru out there ? :-) Sorry, but I cannot answer your questions, since I am stuck in a much earlier stage of serial programming in FreeBSD/Unix. I'm in a Windows-environment only. A Windowns machine can communicate via the serial port with one of our data acquisition equipement (it's a chemistry lab here). The serial data exchange is well documented in the equipement manuals; e.g. 9600 baud, 8 bits, no stop bit etc. in duplex mode receiving and sending data/commands. The Windows C-program is directly manipulating the registers on the 16550A RS232 port, it's interrupt driven and works like a charm. I want to this data acquisition using a FreeBSD OS. Strange enough, all documentation I can find is related to terminal or console serial setups. Is nobody using FreeBSD/Unix for data acquisition in research environment? So where do I start? I'd thought a good starting point to learn how things work, would be at first implementing: int main() { int fd = ; struct termios t; speed_t s1, s2; tcgetattr(fd, &t); s1 = cfgetispeed(&t); s2 = cfgetospeed(&t); } But what is fd in this context of serial port communication? ---- And eh, is this actually the right way to go for data acquisition? Thanks, Rob Lahaye Seoul National University - Korea > 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