[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [microblaze-uclinux] I2C on uClinux



Hi,

for testing purposes I have written a little program,
which sends to an receives from IIC slaves.
I have attached it to this mail. 
(The makefile assumes that you untar this package
to the user directory of you uClinux-dist)
It uses the dev interface, so make shore to check it
during menuconfig of the kernel.
You will also need the device nodes for i2c.
i2ctool --help will list all possible options.

For example

  i2ctool -d /dev/i2c0 -r -a 0x3c -R 0x00 -c 2

will read 2 bytes of data starting from register
0 of the device with address 0x3c from the first
i2c bus. (Assuming you have an i2c capable device
where you can address the registers this way)

To see the addresses of the devices attached to the bus
you may set scan = 1 (in drivers/i2c/xilinx_iic/i2c_algo_xilinx.c)

Hope this helps

Cheers,
Erik

****************************
Erik Hansen
SHF Communication Technologies AG
Wilhelm-von-Siemens-Str. 23D
12277 Berlin
Germany
phone: +49 (30) 77 20 51 0
fax  : +49 (30) 75 31 07 8
****************************
 

> -----Original Message-----
> From: owner-microblaze-uclinux@itee.uq.edu.au 
> [mailto:owner-microblaze-uclinux@itee.uq.edu.au] On Behalf Of sky tam
> Sent: Tuesday, February 22, 2005 2:55 PM
> To: microblaze-uclinux@itee.uq.edu.au
> Subject: [microblaze-uclinux] I2C on uClinux
> 
> 
> I am dealing with I2C control on uClinux. I would like to ask how can
> I access SCL and SDA in C program in order to control a device. If
> there any one has some C program examples that can be run on uclinux
> to sccess I2C? thx
> 
> SKY
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@itee.uq.edu.au
> Project Home Page : 
> http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive : 
> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
> 
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 
> 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Attachment: i2ctool.tar.gz
Description: i2ctool.tar.gz