This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DRV_i2c16Write16() timeout waiting for bus ready



I am use Aptina AR0130 sensor replace OV2715, kernel version is 2.6.18

DRV_imgsCheckId call DRV_i2c16Read16,get the sensor ID ok.

But the next step DRV_imgsEnable & DRV_imgsSetAgain  call DRV_i2c16Write16,sometimes DRV_i2c16Write16  return ok, sometimes the error may prints below  :

ERROR (drv_imgs_AR0130_1.2MP.c|DRV_imgsEnable|411): DRV_imgsSetRegs()
[ 10.980000] i2c_davinci i2c_davinci.1: timeout waiting for bus ready
[ 10.980000] i2c_davinci i2c_davinci.1: timeout waiting for bus ready
ERROR (drv_imgs_AR0130_1.2MP.c|DRV_imgsSetAgain|322): DRV_i2c16Write16()
[ 12.020000] i2c_davinci i2c_davinci.1: timeout waiting for bus ready
[ 12.020000] i2c_davinci i2c_davinci.1: timeout waiting for bus ready

My question is:

1、The error is caused by hardware or software ?

2、Is there any solution to check out 

Best regards

lious liu 

  • Hi Lious,

    If you want to check this problem either h/w or s/w then remove the i2c APTINA sensor platform init in board file located at "arch/arm/mach-davinci/<board> and try whether the problem exist or not.

    What is the operating I2C clock freq ?

    What is the i2c frequency supported by APTINA sensor (check data sheet of sensor) ?

    What are all the i2c devices has been connected on the same i2c bus?

    Try to implement i2c bus recovery in i2c driver.

    Try to reduce the i2c clock frequency to 40 or 20KHz for testing?

    http://e2e.ti.com/support/embedded/linux/f/354/t/70448.aspx

    http://linux.davincidsp.com/pipermail/davinci-linux-open-source/2010-January/017526.html

    I hope it helps.

  • Hi Titusrathinaraj Stalin,

    I changed the bus frequency from 400k to 100k(20、40k) in file devices.c, the result is not ok.

    CLKL=CLKH=54
    bus_freq = 100
    input_clock = 24000000
    I2C_PRESCALED_CLOCK = 12000000

    The bootup log attached below2045.liuxm.log

  • Hi,

    1) do "hwclock -r" for reading time when you are getting errors in i2c bus.

    2) Probe the i2c clock line to measure/ensure exact frequency?

    3) Do one experiment for narrow down to find the cause of the issue,Short the i2c data line to ground and tell what is happening on the i2c bus and console and do not initialize/call the aptina camera sensor.

    4) To avoid this kind of errors; Try to implement i2c bus recovery s/w code in i2c driver.

  • HI,Titusrathinaraj Stalin,

    1) do "hwclock -r" for reading time when you are getting errors in i2c bus.

    Sometimes the rtc ds1307 init ok,sometimes init fail,if I short the i2c data line to ground, the boot logs of ds1307 init shows:

    [ 1.340000] i2c_davinci i2c_davinci.1: controller timed out
    [ 1.340000] i2c_davinci i2c_davinci.1: initiating i2c bus recovery

    If ds1307 init ok and donot init AR0130, do "hwclock -r", the result will be

    hwclock -r
    Thu Mar 6 11:00:34 2014 0.000000 seconds

    if ds1307 init ok and init AR0130 do "hwclock -r", the result exists two different result :

    hwclock -r
    Thu Mar 6 11:00:34 2014 0.000000 seconds

    OR

    [ 1.340000] i2c_davinci i2c_davinci.1: controller timed out
    [ 1.340000] i2c_davinci i2c_davinci.1: initiating i2c bus recovery

    2) Probe the i2c clock line to measure/ensure exact frequency?

    The exact frequency is 100k, I Probe both ds1307 init and Ar0130 sensor init

    but the i2c signal get dirty if we Init AR0130,which shows below

    3) Do one experiment for narrow down to find the cause of the issue,Short the i2c data line to ground and tell what is happening on the i2c bus and console and do not initialize/call the aptina camera sensor.

    [ 0.340000] ds1307_init begin 
    [ 0.340000] ds1307_attach_adapter begin 
    [ 1.340000] i2c_davinci i2c_davinci.1: controller timed out
    [ 1.340000] i2c_davinci i2c_davinci.1: initiating i2c bus recovery
    [ 1.350000] ds1307_attach_adapter end return = 0 
    [ 1.350000] ds1307_init end return 0

    4) To avoid this kind of errors; Try to implement i2c bus recovery s/w code in i2c driver.

    I have patched the i2c-davinci.c and rebuild and rewrite to nand, the test from 1) to 3)  are based on patched version.

  • Hi Lious,

    [ 1.340000] i2c_davinci i2c_davinci.1: controller timed out
    [ 1.340000] i2c_davinci i2c_davinci.1: initiating i2c bus recovery

    It seems that the i2c bus recovery has been initiated but I think it doesn't help for sensor problem.

    I'm get confused that whether the i2c bus recover has been initiated due to shorting the i2c data line to ground or due to sensor i2c timeout issue.

    Can you please confirm that whether the i2c bus recovery is happening ("initiating i2c bus recovery" ) while you working with camera problem.

    Here afterwards do not short i2c data line to ground.

  • Hi:

    THe reason is the hardware design bug

    lious liu

  • Hi,

    Thanks for your update.