I2C


I've been working on an I2C bus driver for the WGT634U's GPIO pins. This I2C bus driver has worked (preliminary testing only) under Kamikaze r5435 with 2.6.17 kernel:

http://openwrt.pbwiki.com/f/i2c-bcm5365.c

I was able to flip the output bits on a PCF8574 chip with a user-space program talking to /dev/i2c-0.

 

Here are my steps to installing it:

 

 

running lsmod on the router should show all four i2c-* modules loaded.

 

You can specify which gpio bits are used in /etc/modules.d/nn-i2c-bcm5365, e.g.

 

You must mknod /dev/i2c-0 c 89 0 to create the character device for user-space access to the bus.

 


 

Now available as an ipkg! I'll post steps to how I made it here soon (See I2CPackage)... meanwhile, you can try to ipkg install kmod-i2c_2.6.17-brcm-1_mipsel.ipk. Then insmod i2c-core, insmod i2c-dev, insmod i2c-algo-bit and insmod i2c-bcm5365 . Make sure you mknod /dev/i2c-0 c 89 0 ! I haven't tried to see if the i2c bus works yet, I just wanted to get this up here. All the modules loaded fine, but I did have to ipkg -force-depends install ... (OpenWrt changed the kernel versioning since 5370). If this works/doesn't, let me (flyashi-@-gmail) know :) Thanks!

 

P.S. HUGE thanks to Chuck Harrison for this awesome driver!

P.P.S. If you have any programs to access I2C devices (PCF8574, other GPIO chips, ADC chips, etc.), it would be nice to post them here for everyone to use :) I'm going to write one for a thermistor chip to monitor the CPU temp :D

 

Update for Kamikaze 7.09! Now that Kamikaze comes from the OpenWrt developers officially, I've stopped messing with new images (well, for now). But since we have a common basis to work from, I've updated Chuck's I2C driver for 2.6.22 and packaged it as an ipkg: same directions as above, but the file is now: ipkg install http://openwrt.pbwiki.com/f/kmod-wgti2c_0%2B2.6.22-brcm47xx-1_mipsel.ipk . I've successfully run a MCP23017 GPIO expander and DS1631+ temperature sensor. It's quite nifty.

 


some command-line i2c programs

These have worked under recent kamikaze w/2.6.17 kernel (and Kamikaze 7.09/Linux 2.6.22 as well)

 

<device node> is typically /dev/i2c-0.

Note: <dev addr> above is in the range 0-127 (7-bit address). If your datasheet says "write address 0x40, read address 0x41" it is talking about 8-bit codes which include the read/write flag as LSB. The corresponding 7-bit <dev addr> is 0x20 (decimal 32).

 


Some more command line programs

Tested under Kamikaze 7.09/Linux 2.6.22

 

The above are by no means complete. Use them as you wish, no warranty provided, though you can contact me for help.

compile needs to be modified with the path to your OpenWrt installation (either the SDK, ImageBuilder, or full install).

The rest use chips that you can get from Microchip.

http://www.charmed.com/txt/dev-interface.txt has some info on Linux user-space I2C programming via the /dev/ interface, which Chuck's driver provides and all the above programs use.

 


 

WifiCar v2 uses I2C! http://charlie.okshtein.net/

 

lcd4linux uses I2C to drive a standard (HD44780) LCD with a PCF8574 by default to display a lot of informations.

you have to modify the settings for plugins and size (see here)

 

car movers

If you add a new topic, please add it to this list on the main page so people can easily find it.
You can easily add a new page by creating a wiki link with the title of the page like Car Shipping Rates
 you want to create on the front page. Then, when you click on that link, you will be taken to a new page that you can add to.