ADT7420 reading under Linux

Document created by analog-archivist Employee on Feb 23, 2016Last modified by MH@CAC on Feb 25, 2016
Version 2Show Document
  • View in full screen mode

Q

We design a new pcb with ADT7420.


We verify  :

 

-          the power supply : OK (3.3V)

 

-          I2C waveform : OK (verify with oscilloscope)

 

-          we can read other component connected to the same I2C bus example an
EEPROM and a Demodulator.

 

-          No communication problem : the ADT7420 acknowledge our command.

 

-          We use the good I2C address to communicate with the ADT7420 (0x48).

 

-          We can change this address, the device respond to the defined
address.

 

-          We don’t have other device with the same address.

 

-          I2C speed (SCL Frequency) is less than the 400khz (133khz or 80khz
or 96khz)

 

-          pull-ups resistor are 1K5 (we test also with 10K)

 

 

 

The problem :

 

When we read the ADT7420 with the i2cdump (Linux) command we have this result :
 

 

 

 

i2cdump -f -y 0 0x48;

 

No size specified (using byte-data access)

 

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef

 

00: 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15    ????????????????

 

10: 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15    ????????????????

 

20: 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 00    ???????????????.

 

30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

 

 

The value 0x15 read by the software is the same value to the oscilloscope.

 

 

 

The value 0x15 can be also 0x12, 0x13, 0x14, 0x0F, 0x0e.

 

 

 

We are under linux. 
In the command line, we use the standard 'i2cget'.
This command issues an I2C write (with a STOP) and then a I2C read.

 

In our software, we use :
    open("/dev/i2c-0", O_RDWR);
     ioctl(file, I2C_SLAVE, i2c_address);
    write(file,pucInternalAddress,1);
   read(file,pData,size);
This way, it also sends a STOP after the write.
Can you tell us how to avoid this ? Is there some special methods under linux
to this ?
I imagine you have many customers under linux and they also encountered this
issue.

 

A

Please have a look into the code under the following links. The first one was
written for ADT7410 / ADT7420 under Linux. The second one is much detailed and
also contains the code for SPI parts.

 

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/hwm
on/adt7410.c

 

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/hwm
on/adt7x10.c

Attachments

    Outcomes