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.

I2C implementation question - Linux on OMAP L138 using LogicPD's Zoom EVM Development Kit

I have been stuck for a while on trying to get 2 GPIO pins set up for use in the I2C bit-banging GPIO driver in Linux.  I believe that I have the pinmux settings correct:

From da850.c:
                MUX_CFG(DA850, GPIO0_0,         1,      28,     15,     8,      false)
                MUX_CFG(DA850, GPIO0_6,         1,      4,      15,     8,      false)

I have registered the board info and now get Linux to believe that the bus is there at boot time:

i2c-gpio i2c-gpio.1: using pins 20 (SDA) and 21 (SCL)
i2c-gpio i2c-gpio.2: using pins 6 (SDA) and 0 (SCL)         <== Pins that I specified and registered in board-da850-evm.c

Using i2ctools, I can see this with i2cdetect:
root@arago:~/i2ctools# ./i2cdetect -l
i2c-1   i2c             i2c-gpio1                               I2C adapter
i2c-2   i2c             i2c-gpio2                               I2C adapter     <== My adapter

However, when I look at that bus (./i2cdetect 2), nothing shows up. I have the dev board connected to a Sparkfun temperature sensor via J30, with SDA on pin 17, SCL on pin 92 and ground on pin 80.  Power (3.3v) is supplied via the Sparkfun processor/power board.  Correct voltages were measured at the temperature sensor but no pulses appear on the SCL line.

I think I am missing something in the driver setup.  Can somebody give me a little shove in the right direction?

  • Sounds like you have make all the changes to the code. Double check:

    ---arch/arm/mach-davinci/da850.c---

    static const struct mux_config da850_pins[] = {
    #ifdef CONFIG_DAVINCI_MUX
        /* UART0 function */
    ...
        MUX_CFG(DA850, ECAP2_APWM2,    1,    0,    15,    4,    false)

        /* More GPIO function */                           /* Add */
        MUX_CFG(DA850, GPIO0_0,        1,    28,    15,    8,    false) /* Add */
        MUX_CFG(DA850, GPIO0_6,        1,    4,    15,    8,    false) /* Add */
    #endif
    };

    ---arch/arm/mach-davinci/include/mach/mux.h---

    enum davinci_da850_index {
        /* UART0 function */
        DA850_NUART0_CTS,
    ...
        DA850_ECAP2_APWM2,

        /* More GPIO function */ /* Add at end of list */
        DA850_GPIO0_0, /* Add at end of list */
        DA850_GPIO0_0, /* Add at end of list */
    };


    ---arch/arm/mach-davinci/board-da850-evm.c---
    ...
    static const short da850_evm_i2c_gpio2_pins[] = {
        DA850_GPIO0_0,
        DA850_GPIO0_6,
        -1
    };
    ...
    static __init void da850_evm_init(void)
    {
    ...
        ret = davinci_cfg_reg_list(da850_evm_i2c_gpio2_pins);
        if (ret)
            pr_warning("da850_evm_init: i2c_-pio2 setup failed: %d\n", ret);
    ...
    }

    Those pins may get muxed in for other modules. The da850.c file gives the ones that are defined and might be used:

    MUX_CFG(DA850,    AXR_8,        1,    28,    15,    1,    false)
    MUX_CFG(DA850,    MCBSP1_CLKS,    1,    28,    15,    2,    false)
    MUX_CFG(DA850,    ECAP1_APWM1,    1,    28,    15,    4,    false)

    MUX_CFG(DA850,    AXR_14,        1,    4,    15,    1,    false)
    MUX_CFG(DA850,    MCBSP1_CLKR,    1,    4,    15,    2,    false)

    Check you board.c file to see if there is any intiialization that is muxing your pins away from your GPIO function.

    I believe bit-bang I2C via GPIO still require pull-ups resistors on the SCL and SDA.

  • Norman,

    Thanks for the reply!  I think I am much farther along now due to your assistance.  I was missing the following piece:

    static __init void da850_evm_init(void)
    {
    ...
        ret = davinci_cfg_reg_list(da850_evm_i2c_gpio2_pins);  <<<<========= The missing piece!
        if (ret)
            pr_warning("da850_evm_init: i2c_-pio2 setup failed: %d\n", ret);
    ...
    }

    Your comment about checking for other initialization that was muxing my pins was also good.  I found that the McBSP was taking one of my pins and since we aren't planning on using it, I disabled it in the kernel configuration.

    Thanks for your assistance!

    Steve