Hi there,
I am having some issues getting the I2C3 working. Bus 1 and 2 are working flawlessly. The bus is connected to pads
MX53_PAD_GPIO_5__I2C3_SCL
MX53_PAD_GPIO_6__I2C3_SDA
I have ensured no other alternate functions of these pads has been enabled by mistake and I have checked that the memory addresses, registers and clocks are correctly set up, which is the case as far as I can see.
I have enabled debug output in i2c-imx.c and the console output shows the following errors:
<7>i2c i2c-2: <i2c_imx_xfer>
<7>i2c i2c-2: <i2c_imx_start>
<7>i2c i2c-2: <i2c_imx_bus_busy>
<7>i2c i2c-2: <i2c_imx_xfer> transfer message: 0
<7>i2c i2c-2: <i2c_imx_write> write slave address: addr=0x70
<7>i2c i2c-2: <i2c_imx_trx_complete> Timeout
<7>i2c i2c-2: <i2c_imx_stop>
<7>i2c i2c-2: <i2c_imx_bus_busy>
<7>i2c i2c-2: <i2c_imx_bus_busy> I2C bus is busy
<7>i2c i2c-2: <i2c_imx_xfer> exit with: error: -110
This was what I expected because the signals on SDA/SCL lines of I2C3 is not as expected. The clock dutycycle is very short compared to I2C1 and I2C2 and the frequency is 200khz where it should be 100khz as declared in mxci2c_data and is used for all three busses. And finally the data line goes high after the firste to clock pulses.
Anybody seen something similar?
Best regards
martin
Found the culprit. It was a missing bit on the I2C3 SCL on GPIO 5 which needs to be set. This will force the input path to be active regardsless of the pad function. Therefore IOMUX_CONFIG_SION must be or'ed on the mux control.
I changed the the line below in iomux-mx53.h:
#define _MX53_PAD_GPIO_5__I2C3_SCL IOMUX_PAD(0x6C0, 0x330, 6 | IOMUX_CONFIG_SION, 0x824, 2, 0)
Again, thanks for your replies Vladan and Joshua
Thanks for the tip Vladan, I wasn't aware of this potential problem. I will take a look right away.
Vladan Jovanovic said:
Did you configure daisy chain registers correctly?
Check Chapter 4.2.2 in i.MX53 Ref. Manual. For I2C3 it's IOMUXC_I2C3_IPP_SCL_IN_SELECT_INPUT and IOMUXC_I2C3_IPP_SDA_IN_SELECT_INPUT that need to be configured properly.
Vladan
Thanks for your reply Joshua,
What was your problem back then? Do you have communication on I2C3 now using android+ freescale r10.3.1 patches?
I have attached all lines related to I2C from my board file, I have to get clearance before posting the file in its entirety.
static iomux_v3_cfg_t mx53_board_pads[] = {
:
:
/* I2C1 */
MX53_PAD_CSI0_DAT8__I2C1_SDA,
MX53_PAD_CSI0_DAT9__I2C1_SCL,/* I2C2 */
MX53_PAD_KEY_COL3__I2C2_SCL,
MX53_PAD_KEY_ROW3__I2C2_SDA,/* I2C3 */
MX53_PAD_GPIO_5__I2C3_SCL,
MX53_PAD_GPIO_6__I2C3_SDA,
:
:
};
static struct imxi2c_platform_data mxci2c_data = {
.bitrate = 100000,
};static struct i2c_board_info mxc_i2c0_board_info[] __initdata = {
{
.type = "tda998X",
.addr = 0x70,
.irq = gpio_to_irq(TDA19988_INT),
}
};static struct i2c_board_info mxc_i2c1_board_info[] __initdata = {
};static struct i2c_board_info mxc_i2c2_board_info[] __initdata = {
{
.type = "p1003_fwv33",
.addr = 0x41,
},
{
.type = "egalax_ts",
.addr = 0x4,
},
{
.type = "sta559bw-i2c",
.addr = 0x38,
},
};
static void __init mxc_board_init(void)
{
:
:
mxc_register_device(&mxci2c_devices[0], &mxci2c_data);
mxc_register_device(&mxci2c_devices[1], &mxci2c_data);
mxc_register_device(&mxci2c_devices[2], &mxci2c_data);
:
i2c_register_board_info(0, mxc_i2c0_board_info,
ARRAY_SIZE(mxc_i2c0_board_info));
i2c_register_board_info(1, mxc_i2c1_board_info,
ARRAY_SIZE(mxc_i2c1_board_info));
i2c_register_board_info(2, mxc_i2c2_board_info,
ARRAY_SIZE(mxc_i2c2_board_info));
:
/* Init pmic */
pm_i2c_init(I2C2_BASE_ADDR - MX53_OFFSET);
}
Did you configure daisy chain registers correctly?
Check Chapter 4.2.2 in i.MX53 Ref. Manual. For I2C3 it's IOMUXC_I2C3_IPP_SCL_IN_SELECT_INPUT and IOMUXC_I2C3_IPP_SDA_IN_SELECT_INPUT that need to be configured properly.
Vladan
I have worked on this before, can you possibly post your board file. (for instance -- mx53_loco.c)
Also, there is a nice package for linux to play with the i2c interface called i2c-tools.