LaFonera Hardware i2c

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 03:04, 28 October 2007 (edit)
Wildblue (Talk | contribs)
(added content)
← Previous diff
Revision as of 03:18, 25 November 2007 (edit) (undo)
Wildblue (Talk | contribs)
(added new content)
Next diff →
Line 69: Line 69:
<pre> <pre>
root@OpenWrt:/# ds75ioctl -d /dev/i2c-0 -a 0x48 root@OpenWrt:/# ds75ioctl -d /dev/i2c-0 -a 0x48
-23.81+23.8150
</pre> </pre>
Line 76: Line 76:
[[Image:LaFonera_Hardware_i2c_-_02_sensor.jpg]] [[Image:LaFonera_Hardware_i2c_-_02_sensor.jpg]]
 +
 +
 +
 += PCB =
 +Here is the PCB of i2c adapter for La Fonera.
 +
 +[[image:LaFonera_Hardware_i2c_-_03_PCB.jpg]]
 +
 +
 +
 += Files =
 +You can find Sources, binaries for OpenWrt Kamikaze 7.06, schematic and PCB here: http://www.lefinnois.net/fonerai2c/.
 +
 +
 +== Mirror for files existing on 2007-11-25 ==
 +
 +=== / ===
 +[http://www.wildblue.de//fonera/i2c/files/fonera_i2c.pdf fonera_i2c.pdf]
 +
 +[http://www.wildblue.de//fonera/i2c/files/i2c-gpio-0.0.5.tar.gz i2c-gpio-0.0.5.tar.gz]
 +
 +[http://www.wildblue.de//fonera/i2c/files/i2c-gpio-0.0.6.tar.gz i2c-gpio-0.0.6.tar.gz]
 +
 +[http://www.wildblue.de//fonera/i2c/files/i2c_gpio.pdf i2c_gpio.pdf]
 +
 +[http://www.wildblue.de//fonera/i2c/files/i2c_gpio.tar.gz i2c_gpio.tar.gz]
 +
 +[http://www.wildblue.de//fonera/i2c/files/i2cdetect.tar.gz i2cdetect.tar.gz]
 +
 +
 +=== /7.06/atheros-2.6/packages/ ===
 +[http://www.wildblue.de//fonera/i2c/files/7.06/atheros-2.6/packages/i2cdetect_0.1-1_mips.ipk i2cdetect_0.1-1_mips.ipk]
 +
 +[http://www.wildblue.de//fonera/i2c/files/7.06/atheros-2.6/packages/kmod-i2c-algos_2.6.19.2-atheros-1_mips.ipk kmod-i2c-algos_2.6.19.2-atheros-1_mips.ipk]
 +
 +[http://www.wildblue.de//fonera/i2c/files/7.06/atheros-2.6/packages/kmod-i2c-core_2.6.19.2-atheros-1_mips.ipk kmod-i2c-core_2.6.19.2-atheros-1_mips.ipk]
 +
 +[http://www.wildblue.de//fonera/i2c/files/7.06/atheros-2.6/packages/kmod-i2cgpio_2.6.19.2-atheros-1_mips.ipk kmod-i2cgpio_2.6.19.2-atheros-1_mips.ipk]
 +
 +
 +=== /7.07/atheros-2.6/packages/ ===
 +[http://www.wildblue.de//fonera/i2c/files/7.07/atheros-2.6/packages/i2cdetect_0.1-1_mips.ipk i2cdetect_0.1-1_mips.ipk]
 +
 +[http://www.wildblue.de//fonera/i2c/files/7.07/atheros-2.6/packages/kmod-i2c-algos_2.6.21.5-atheros-1_mips.ipk kmod-i2c-algos_2.6.21.5-atheros-1_mips.ipk]
 +
 +[http://www.wildblue.de//fonera/i2c/files/7.07/atheros-2.6/packages/kmod-i2c-core_2.6.21.5-atheros-1_mips.ipk kmod-i2c-core_2.6.21.5-atheros-1_mips.ipk]
 +
 +[http://www.wildblue.de//fonera/i2c/files/7.07/atheros-2.6/packages/kmod-i2cgpio_2.6.21.5-atheros-1_mips.ipk kmod-i2cgpio_2.6.21.5-atheros-1_mips.ipk]
 +
 +
 +=== /Packages/ ===
 +[http://www.wildblue.de//fonera/i2c/files/Packages/i2cdetect_0.1-1_mips.ipk i2cdetect_0.1-1_mips.ipk]
 +
 +[http://www.wildblue.de//fonera/i2c/files/Packages/kmod-i2c-algos_2.6.19.2-atheros-1_mips.ipk kmod-i2c-algos_2.6.19.2-atheros-1_mips.ipk]
 +
 +[http://www.wildblue.de//fonera/i2c/files/Packages/kmod-i2c-core_2.6.19.2-atheros-1_mips.ipk kmod-i2c-core_2.6.19.2-atheros-1_mips.ipk]
 +
 +[http://www.wildblue.de//fonera/i2c/files/Packages/kmod-i2cgpio_2.6.19.2-atheros-1_mips.ipk kmod-i2cgpio_2.6.19.2-atheros-1_mips.ipk]

Revision as of 03:18, 25 November 2007

Contents

i2c bus for La Fonera

The goal for my first try to use Fonera’s GPIO is to get i2c working on the router. And now, it’s done. Kernel module and user space programs are here.

Image:LaFonera_Hardware_i2c_-_01_overview.jpg

My kernel implementation use 4 GPIO on SW1 (1-2-5-6) near the Ethernet connector. Pin 1 and 2 are respectively used for sending and receiving SDA signals. 5 and 6, for SCL signals.

The GPIO are connected to a 75LS05 (TTL hex inverter) used as level adapter and buffer. You can see schematic here (PDF) (mirror).

On the software side, my module is based on i2c-parport-light. Linux i2c stack is very complete, all i have to do is to use bit-banging i2c API (2c-algo-bit module). My driver, i2c_gpio,
is available here: i2c-gpio-0.0.5.tar.gz (mirror). Take a look to the README file to get more information.

To test i2c bus, simply use i2cdetect from lm-sensors project. This tool can scan i2c bus to detect chips. Here is a adapted version for La Fonera as a ipkg source package: i2cdetect.tar.gz (mirror). This file contain also ds75ioctl. It’s a simple tool that can talk to DS75 thermal sensor.


Example :

insmod i2c_algo_bit i2c_debug=3 bit_test=1
insmod i2c_gpio inverted=1


In dmesg :

i2c-algo-bit.o: (0) scl=128, sda=16
i2c-algo-bit.o: (1) scl=128, sda=0
i2c-algo-bit.o: (2) scl=128, sda=16
i2c-algo-bit.o: (3) scl=0, sda=16
needed 1 jiffies
i2c-algo-bit.o: (4) scl=128, sda=16
i2c-algo-bit.o: GPIO adapter passed test.
 : hw routines registered.
i2c_adapter i2c-0: adapter GPIO adapter registered
i2c-dev: adapter GPIO adapter registered as minor 0
gpio_i2c: module loaded
gpio_i2c: inverted outputs


i2c bus seem to work well. Let’s try i2cdetect :

root@OpenWrt:/# i2cdetect -l
i2c-0   i2c    GPIO adapter  Algorithm unavailable


We have a bus here, so let’s scan it :

root@OpenWrt:/# i2cdetect 0
WARNING! This program can confuse your I2C bus,
cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? Y/n
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          XX XX XX XX XX XX XX XX XX XX XX XX XX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
40: XX XX XX XX XX XX XX XX 48 XX XX XX XX XX XX XX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
70: XX XX XX XX XX XX XX XX


Hey ! There is something at 0×48 :

root@OpenWrt:/# ds75ioctl -d /dev/i2c-0 -a 0x48
23.8150


23.81°C. It works !

Image:LaFonera_Hardware_i2c_-_02_sensor.jpg


PCB

Here is the PCB of i2c adapter for La Fonera.

image:LaFonera_Hardware_i2c_-_03_PCB.jpg


Files

You can find Sources, binaries for OpenWrt Kamikaze 7.06, schematic and PCB here: http://www.lefinnois.net/fonerai2c/.


Mirror for files existing on 2007-11-25

/

fonera_i2c.pdf

i2c-gpio-0.0.5.tar.gz

i2c-gpio-0.0.6.tar.gz

i2c_gpio.pdf

i2c_gpio.tar.gz

i2cdetect.tar.gz


/7.06/atheros-2.6/packages/

i2cdetect_0.1-1_mips.ipk

kmod-i2c-algos_2.6.19.2-atheros-1_mips.ipk

kmod-i2c-core_2.6.19.2-atheros-1_mips.ipk

kmod-i2cgpio_2.6.19.2-atheros-1_mips.ipk


/7.07/atheros-2.6/packages/

i2cdetect_0.1-1_mips.ipk

kmod-i2c-algos_2.6.21.5-atheros-1_mips.ipk

kmod-i2c-core_2.6.21.5-atheros-1_mips.ipk

kmod-i2cgpio_2.6.21.5-atheros-1_mips.ipk


/Packages/

i2cdetect_0.1-1_mips.ipk

kmod-i2c-algos_2.6.19.2-atheros-1_mips.ipk

kmod-i2c-core_2.6.19.2-atheros-1_mips.ipk

kmod-i2cgpio_2.6.19.2-atheros-1_mips.ipk


Refrences



this page was made by wildblue!