2009-03-18 07:01:01     MAX7313 on I2C

Document created by Aaronwu Employee on Aug 14, 2013
Version 1Show Document
  • View in full screen mode

2009-03-18 07:01:01     MAX7313 on I2C

ian davidson (UNITED KINGDOM)

Message: 71199   


We are nearing compleation of our BSP for our new board and have written drivers for devices on the I2C ( OLEDS and a number of MAX7313 devices). There is also a SPORT interrupt handler. The MAX chips have connected to them a number of rotary encoders. All the test programs for the MAX inputs, MAX outputs, OLEDS and SPORT work just fine alone.


However, when they are all run together the MAX chips start to return invalid data when the registers are being read.


The OLED display test blasts I2C data out to the displays as fast as it can. The SPORT int handler was reduced to a "for loop" to waste 200us every 2.4ms. The encoder test program has to read the MAX chips to see which inputs have changed. The OLED and ENcoder test run together OK. The SPORT int and Encoder test run together OK


It is only when we run all three together that the encoder test fails, the register data read back from the MAX chip is incorrect. No errors are reported by the smb i2c routines.


As you can imagine, with so much activity on the I2C bus it is difficult to examine the activity when it goes wrong.


Changing the interrupt priorities had no effect, the default ones are sensible.


We have found a way to make it work, simply by treating the MAX chips as byte devices, and replacing all the calls to i2c_smbus_write_word_data () by two calls to i2c_smbus_write_byte_data ()


I'm sure there is nothing at all wrong with the kernel ( Linux release, build #91 Tue Mar 17 12:55:02 GMT 2009

toolchain: bfin-uclinux-gcc release gcc version 4.1.2 (ADI svn)

user-dist: release 2008R1.5, build #83 Tue Mar 17 12:55:19 GMT 2009

) as these functions have been arround for some time and used on hundreds of I2C devices.


I suspect that the fault is with either the firmware on the Blackfin TWI driver,or the MAX chip itself, more likly the MAX chip.


So my question is, Has anyone used MAX7313 devices on the blackfin successfully using the _word_ smbus routines?


I have it working just fine usine the _byte_ ones, but I would like to know why the _word_ ones fail under these conditions.


Many Thanks,


Ian Davidson




2009-03-18 14:34:02     Re: MAX7313 on I2C

Mike Frysinger (UNITED STATES)

Message: 71216   


we havent tested any maxim parts before, but maybe some one else in the forums has ...