I2C problem,Please tell me ! Thanks

03 Sep 2009

Hello,

I use I2C control TDA7541 and write data to chip.

code is below:

#include "mbed.h"

I2C i2c(p28, p27);
Serial pc(USBTX, USBRX);
DigitalOut myled1(LED1);

int main() {

    pc.printf("Program Begin ...\n");
    
    myled1=0;
    char write_addr[2];
    write_addr[0]=0x00;    // register address
    write_addr[1]=0x0B;   // command
    i2c.write(0xC4, write_addr , 2);   // 0xC4 is chip address
    myled1=1;
    

}

but when I execute the program ,it happen error.

*** assertion failed: timeout < 1000000, file src/i2c_api.c, line 54

Why ?

Please tell me how to do

Thanks

zhenjiang

03 Sep 2009

Hi zhenjiang,

Looking at your code, you are still using the address 0xC4. The address you need for your TDA7541 is 0x62:

#include "mbed.h"

I2C i2c(p28, p27);
Serial pc(USBTX, USBRX);
DigitalOut myled1(LED1);

int main() {
    pc.printf("Program Begin ...\n");    
    myled1=0;
    char write_addr[2];
    write_addr[0]=0x00;    // register address
    write_addr[1]=0x0B;   // command
    i2c.write(0x62, write_addr , 2);   // NOTE: 0x62 is chip address (not 0xC4)
    myled1=1;
}

To help diagnose this, you probably want to go through a few checklist items using this new code above. If you answer each of these questions, that would probably help track down your problem.

  1. How is the TDA7541 getting power? From the mbed 3.3v VOUT/GND pins?
  2. Have you got any indication the chip is running?
  3. What is PIN 57 on the TDA7541 connected to?
  4. What value pull up resistors are you using on the I2C sda and scl lines?
  5. If you disconnect the sda and scl lines from your TDA part and run the program, what is the result printed to the terminal
  6. If you connect the sda and scl lines and run the program with address 0x62, what is the result printed to the terminal
  7. If you change the address to 0x68 (a wrong address), what is the result printed to the terminal

If you answer each of these questions, that will help identify whether it is a hardware, software or library problem.

There is no need to post any more code, and also please reply to this thread rather than starting a new one!

Thanks,

Simon