[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] I2C on uClinux
Hi,
sky tam wrote:
> hi,
>
> here is the problem:
>
> /> i2ctool -r -R 0 -d /dev/i2c0 -c 1 -a 0x2E
> Can not access driver (/dev/i2c0)!
> pid 25: failed 256
I guess you have forgotten to create an apropiate
device node for the i2c driver. When starting
up your linux the i2c driver prints its major device
number. With that you can generate an appropiate
device node either by using mknod (I have not
tested this using uClinux) of by modifing the
the Makefile in the appropriate vendors directory
of your uClinux distribution. For a quick test
you can also generate the device node by adding
it to the romfs/dev directory of uClinux.
Assuming your i2c has the major number 251:
add
DEVICE += i2c0,c,251,0
to the Makefile
or
execute
touch @i2c0,c,251,0
in romfs/dev
or
run
mknod i2c0 c 251 0
in the /dev directory of your running uClinux
c stands for a character device.
In case you are using several i2c cores
you have to generate a device for each of them
by counting up the minor number. See the manual
of mknod for more details.
Erik
--
=================================================
NoisurrectioN
_/| _(|)_ |\_ Next Gig: May 05 - SO36
|/ /|\ \| www: http://www.noisurrection.com/
email: kontakt@noisurrection.com
=================================================
>
> thx
> sky
>
>
> On Wed, 23 Feb 2005 15:05:48 +0100, Hansen Eric
> <hansen@shf-communication.de> wrote:
>
>>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.
>>
>>
>>
>
> ___________________________
> 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/
>
>
>
___________________________
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/