Hi Geert,
thank you very much for this interesting code. I will need to control
some PCF9532 LED drivers via I2C and your I2C driver does exactly
what I need. By reading your code I learned a lot.
My hardware will be available in two weeks or so, and in the meantime
I installed your source code and made a simple test. When I used the
old "I2C_WRITEREG", everything was fine and I got a Slave_NoAck
error. This seems to be normal, because no hardware is connected to
the I2C bus at the moment.
When I tried to use "I2C_WRITE", the kernel freezes, all processes
are stopped and I have to reboot the FOX board. Therefore my simple
question is, whether you tested the I2C driver with no HW connected.
If yes, I have a problem in my setup.
The following code worked for me:
int i2c_arg = I2C_WRITEARG(kMinuten, k9532_regLED0_3,
(k9532_segcode[k9532_letterMinus] & k9532_LedPWM0) >> 8);
Fehler = ioctl(fd_i2c, _IO(ETRAXI2C_IOCTYPE, I2C_WRITEREG),
i2c_arg);
printf("Fehler: %d\n", Fehler);
The following code die crash:
i2cdata_pcf9532.slave = kMinuten;
i2cdata_pcf9532.wlen = 1;
i2cdata_pcf9532.wbuf[0] = k9532_regFrequency0 | k9532_regModeAI;
i2cdata_pcf9532.wbuf[1] = k9532_valueMaxFreq;
i2cdata_pcf9532.wbuf[2] = 0x7F;
i2cdata_pcf9532.wbuf[3] = k9532_valueMaxFreq;
i2cdata_pcf9532.wbuf[4] = 0x7F;
i2cdata_pcf9532.wbuf[5] = (k9532_segcode[k9532_letterMinus] &
k9532_LedPWM0) >> 8;
i2cdata_pcf9532.wbuf[6] = (k9532_segcode[k9532_letterMinus] &
k9532_LedPWM0) & 0x00FF;
Fehler = ioctl( fd_i2c, _IO( ETRAXI2C_IOCTYPE, I2C_WRITE ),
&i2cdata_pcf9532 );
In both cases I did a I2C_Open () before the code above. Oh, and I
switched your code to static Major number:
//#define DYNAMIC_MAJOR_I2CDEV_NUMBER_ALLOC
#undef DYNAMIC_MAJOR_I2CDEV_NUMBER_ALLOC
kind regards
Thomas
Am 07.01.2007 um 19:45 schrieb Geert Vancompernolle:
> Hi,
>
> As I mentioned a while ago (see thread
> http://tech.groups.yahoo.com/group/foxboard/message/3020), I was busy
> studying and possibly trying to improve the current version of the I2C
> driver.
>
> Well, I've just finished reworking the I2C driver. The changes are
> quite drastical. The changes result in a faster driver and now it can
> cope with all possible cases (at least, the ones that I know of...).
>
> The driver has been tested on several I2C components (see further) and
> there are more to come...
>
> I've created a zip file that contains the following items:
>
> - a PDF file describing the changes, showing DSO plots and giving in
> detail the timings of the current I2C implementation.
>
> - a new I2C error header file i2c_errno.h (see PDF file for some
> explanation)
>
> - the changed i2c.h header file
>
> - the changed etraxi2c.h header file
>
> - the new I2C source file
>
> - an example file which has been used to test the I2C driver on the
> following devices:
> * NVM 24C32
> * PCF8574
> * PCF8591
>
> - Makefile to use for the example code.
>
> - switches header file to activate one or more of the tested
> components.
>
> Those interested can have a look over here:
>
> http://tech.groups.yahoo.com/group/foxboard/files/GeertVc
>
> All suggestions/improvements/remarks are welcome.
>
> I would especially ask John Crispin to have a look at the driver (John
> knows what I'm talking about...)
>
> Best rgds,
>
> --Geert
>
>
>
[Non-text portions of this message have been removed]