I2C write problem again !

02 Sep 2009

Hello,

I use I2C interface control slave ,but it can not execute write operation .

This is my chip information below, please look at.

My chip is TDA7541  which is used to AM/FM radio .

Micro system software communicates with tuner by I2C bus protocol as below.

W: 0xC4
R: 0xC5

Write Operation
S   1 1 0 0 0 1 D 0   ACK   0 0 I A4 A3 A2 A1 A0   ACK   Data Byte   ACK   P
Read Operation
S   1 1 0 0 0 1 D 1   ACK   S7 S6 S5 S4 S3 S2 S1 S0   ACK   P
S = Start
P = Stop
ACK = Acknowledge
D = Device address
I = Auto increment mode
A = Sub address
Sx=Read
Be noted that the register 0~29 can only be written but can’t read back data from these
registers by micro-controller. What can be read back from tuner is only a status byte

This is my code below

#include "mbed.h"

I2C i2c(28, 27);
Serial pc(USBTX, USBRX);

const int write_addr=0xC4;    // write_addr is chip address , include a write operation bit
const int read_addr=0xC5;

char addr[2]= {0x00,0x8B};    //addr[0]  is register address and addr[1]  is command

int main() {

    pc.printf("Program Begin ...\n");  // can execute
    i2c.write(write_addr,addr,2);       // can not execute !!!   Why ?

}

 

Could you tell me  why write operation can not execute  ?

and sometime happen errors:

     I2C start W returned incorrect status (0x20) in I2C::write

     SIGABRT: Abnormal termination

I have tried using the address 0x72 and 0x62 in both read and write calls, but it can not execute .

Why ?

Thanks

zhenjiang

02 Sep 2009

Hi zhenjiang,

For the address, 0x62 should be right assuming PIN 57 on your chip is tied to 0v (the configurable address bit).

Another common problem would be the I2C bus is missing the required pull-up resistors.

e.g. as a test, if you disconnect the device, do you get exactly the same result? Or if you change the address.

If everything is the same, then the device is not doing anything, so you want to be checking the bus pull-up resistors, the chip has power, any clock/enable pins etc.

I'll look at I2C soon as we've now got the MAX5842 working, and perhaps a little diagnosis program is in order.

Simon