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

Re: I2C multimaster with devboard 82

----- Original Message -----
From: <Martin.Daublebsky@xxxxxxx.net>
To: <dev-etrax@xxxxxxx.com>
Sent: den 23 september 2003 16:50
Subject: RE: I2C multimaster with devboard 82

> Hi Mikael!
> Thanks for your quick response.
> Our I2C-configuration:
> - The Kernel parameters are(make xconfig):
>     .)Drivers for ETRAX 100LX built-in interfaces
>       -> I2C support: yes
>       -> I2C uses PB not PB-I2C: no
>       -> I2C EEPROM support: no
>     .)Character devices
>       -> I2C support: no
> - included headerfiles:
>     string.h,stdlib.h,stdio.h,
>     fcntl.h,time.h,unistd.h,stropts.h,
>     asm/etraxi2c.h,asm/ioctl.h
> That's the confiuration we have got now.
> So the switch you mentioned, CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C, is
> off, but it does not work in multimaster-mode.
> > There is hardware support for multimaster I2C but as far as I know it
> > not been used by anyone.
> Just for confirmation: I assume that the I2C-bus is only implemented as a
> software-kernel-driver, not in hardware?!

I have never heard of any hardware support that would help multimaster mode,
so I'm not sure what Mikael is referring to, but I wouldn't count on getting
any help from the hardware I'm afraid.

> Why there are 2 different I2C-configuration settings
> in the Kernel-set-up (Drivers for ETRAX... and Character device)?

One is for the ETRAX I2C driver and the other is for what is standard on
most PC mother boards I guess.
The ETRAX driver originates from our Linux 2.0 port when there was
no generic i2c interface I think (and it is probably overkill for
our needs then anyway).

> As far as I can see there is no software support for multimaster
> in the i2c-etraxdriver
> (~/axis/devboard_82/os/linux/arch/cris/drivers/i2c.c).
> I assume that this feature had to be implemented in this driver?!
> Or are there other solutions?

You probably have to implement it in the driver, i.e. add a pull up
resistor to the clock line and change the I2C driver so it changes
direction of the CLK driver appropriatly.
You need CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C=y to be able to do that.
(I don't know how to prevent the multiple masters from starting
a transaction at the same time though - but with at least
ETRAX won't drive the bus unless it have to)

> What about the files in this directory:
> ~/axis/devboard_82/os/linux/drivers/i2c
> May we use them for something?

Really don't know - it might be possible to register an i2c driver
in that framework and use that, but I haven't looked into it.

> For our c-file we use the asm/etraxi2c.h and asm/ioctl.h headerfiles.
> The reading and writing operations work via IOCTL-interface.
> Example:
>   i2c_arg = I2C_READARG(0xC8, 0x09);
>   if (ioctl(fs,_IO(ETRAXI2C_IOCTYPE, I2C_READREG),i2c_arg) < 0)
>   {
>     printf("Error when opening the I2C-Device!\n");
>     close(fs);
>     exit(1);
>   }
> The communication between the axisboard and our EEPROM works.
> Only in conjunction with the 2nd I2C-master (PIC-Controller) there are
> collisions, and the SCL-line never reaches LOW-level.
> Again the question: Is the pull-up resistor missing on the SCL-line on the
> axis-board?

Yes, it is missing and the I2C CLK pin is not changed to an input.
(I guess we never anticipated multiple masters)

> Thanks for your effort,
> best regards
> Martin

Best regards
PS. If you have had trouble accessing our webservers etc. there has
been a large power failure in southern part of Sweden and Denmark,
but most things seems to be ok now DS.