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
#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