From owner-freebsd-questions@FreeBSD.ORG Fri Sep 14 16:59:35 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59B6E16A419 for ; Fri, 14 Sep 2007 16:59:35 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from gaia.nimnet.asn.au (nimbin.lnk.telstra.net [139.130.45.143]) by mx1.freebsd.org (Postfix) with ESMTP id F1AD813C442 for ; Fri, 14 Sep 2007 16:59:33 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from [192.168.1.1] (paqi.nimnet.asn.au [220.233.188.227]) by gaia.nimnet.asn.au (8.8.8/8.8.8R1.5) with ESMTP id CAA07755 for ; Sat, 15 Sep 2007 02:59:28 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Message-ID: <46EABDEF.9080403@nimnet.asn.au> Date: Sat, 15 Sep 2007 02:59:27 +1000 From: Ian Smith Organization: Nimbin Network Association User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.13) Gecko/20061115 X-Accept-Language: en-au, en, en-us MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: how to use iic(4) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2007 16:59:35 -0000 I don't know where else to post this, so I'm hoping someone here can spare me a clue. We're building a small board with two AVR Tiny MCUs chatting to each other over an opto-isolated I2C-compatible bus, hopefully at 400kHz. I hope to use the iicbb(4) on lpbb(4) parallel port interface to talk with either of these MCUs for debugging, control and data acquisition. iic(4) says: ======= The iic character device driver provides generic i/o to any iicbus(4) instance. In order to control I2C devices, use /dev/iic? with the fol- lowing ioctls: Ioctl Description I2CSTART send start condition to the specified device (with 7-bit address) on the bus I2CSTOP send stop condition to the bus I2CRSTCARD reset the bus You may also use read/write routines, then I2C start/stop handshake is managed by the iicbus system. ======= Does the latter statement suggest that ordinary reads from or writes to /dev/iic? could be performed by redirection of say echo and read from a script? Or is the device only accessible by ioctl from eg a C program? Also, iicbb(4) is a master-only interface. I can work with that, but if anyone knows of any iicbus slave-mode code I'm all eyes .. Cheers, Ian (please cc me)