I2C1 Resource Temporarily unavailable and unable to use I2C3

Discussion of your EDM baseboard, your add-on boards or other peripherals for your wandboard.

I2C1 Resource Temporarily unavailable and unable to use I2C3

Postby raulina » Mon Jul 31, 2017 12:42 pm

Hello,

I am using WB quad rev b1. I have written a C code that controls some devices using I2C. First, there is an I2C multiplexer pcA9546A with an address in the range 0x70-0x77. It has 4 output buses, each one has 2 DAC AD5627R are in the addresses 0x0C and 0x0F. The last of the 4 I2C buses from the multiplexer has also a GPIO expander PCA9536 with address 0x41.

I tested the code in the I2C2 (/dev/i2c-1) without any problem, but when I try to use it in I2C1 (/dev/i2c-0) it gives me the error "Resource temporarily unavailable". I am currently using the kernel 4.9.35 and ubuntu, but I also tested it with kernel 3 with linaro (the name of the error changes, but I guess is the same one). I tested 2 different boards, with both kernels and OS, and the same error.

I first execute:
Code: Select all
ioctl(fd, I2C_SLAVE, addr)

which doesn't fail, and then:
Code: Select all
write(fd, data, 3)

which is the line that presumably fails.

- When connected to I2C2, I can execute the program without problems, and the devices appear using i2cdetect before and after the execution.
- When connected to I2C1, if I power off and the turn on the device to be controlled, they appear in the i2cdetect. Once I execute my program, they don't appear any more in i2cdetect until I unplug and plug them again.

I have seen that I2C1 is responsible of the HDMI CEC through DDC, which seems to not have entirely worked, but I have no screen connected to the WB, so I don't know if it should affect.

I also tried to map I2C3 to /dev/i2c-2 by adding this piece of code to the device tree imx6q-wandboard-revb1.dts (but to be honest, I am not sure what I am doing... I just tried to learn and understand how device trees work):


Code: Select all
&i2c3 {
   clock-frequency = <100000>;
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_i2c3>;
   status = "okay";
};

&iomuxc {
   pinctrl-names = "default";
   imx6q-wandboard-revb1 {
      pinctrl_i2c3: i2c3grp {
         fsl,pins = <
            MX6QDL_PAD_GPIO_5__I2C3_SCL      0x4001b8b1
            MX6QDL_PAD_GPIO_16__I2C3_SDA      0x4001b8b1
         >;
      };
   };
};


In this case, /dev/i2c-2 is available, but when I try to connect the error "Connection timed out" is shown. When I do this, I loose Ethernet connectivity because one of the pins is used for the ethernet clock. Despite this, I used an oscilloscope on the lines but I don't see the I2C signal.
Questions:

- Is the "Resource temporarily unavailable" error caused by DDC? If I remove the resistors R113 and R115, would I be able to use I2C1 without any problem? By the way, where are they? I tried to find them in the EDM but I can't find them.
- What is wrong in the code I used correct to enable I2C3? How can I enable I2C3 properly, even if I loose ethernet connectivity?

Thank you very much.

EDIT: I just read that X components are not mounted, so EEPROM is not the problem, and the DDC is alocated in the I2C1. May it be the source of the problem?
EDIT 2: I add my device tree file just in case someone wants to take a look:

Code: Select all
/*
 * Copyright 2013 Freescale Semiconductor, Inc.
 *
 * Author: Fabio Estevam <fabio.estevam@freescale.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */
/dts-v1/;
#include "imx6q.dtsi"
#include "imx6qdl-wandboard-revb1.dtsi"

/ {
   model = "Wandboard i.MX6 Quad Board rev B1";
   compatible = "wand,imx6q-wandboard", "fsl,imx6q";

   memory {
      reg = <0x10000000 0x80000000>;
   };
};

&sata {
   status = "okay";
};

&ecspi1 {
    fsl,spi-num-chipselects = <1>;
   cs-gpios = <&gpio2 30 0>; /* EIM_EB2 */
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_ecspi1>;
   status = "okay";

        spidev@0 {
        compatible = "rohm,dh2228fv";
        spi-max-frequency = <10000000>;
        reg = <0>;
        };
};


&i2c3 {
   clock-frequency = <100000>;
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_i2c3>;
   status = "okay";
};

&iomuxc {
   pinctrl-names = "default";

   imx6q-wandboard-revb1 {
      pinctrl_ecspi1: ecspi1grp-1 {
                  fsl,pins = <
            MX6QDL_PAD_EIM_D17__ECSPI1_MISO 0x100b1
            MX6QDL_PAD_EIM_D18__ECSPI1_MOSI 0x100b1
            MX6QDL_PAD_EIM_D16__ECSPI1_SCLK 0x100b1
            MX6QDL_PAD_EIM_EB2__GPIO2_IO30  0x000f0b0
            MX6QDL_PAD_KEY_COL2__GPIO4_IO10 0x000f0b0
                  >;
           };
      pinctrl_i2c3: i2c3grp {
         fsl,pins = <
            MX6QDL_PAD_GPIO_5__I2C3_SCL      0x4001b8b1
            MX6QDL_PAD_GPIO_16__I2C3_SDA      0x4001b8b1
         >;
      };

   };
};
raulina
 
Posts: 15
Joined: Thu May 05, 2016 3:23 pm

Re: I2C1 Resource Temporarily unavailable and unable to use

Postby raulina » Wed Aug 02, 2017 1:11 pm

I finally decided to removed R113 and R115 and now it seems to work.

I used an oscilloscope to see the voltage levels of the I2C lines when I connected a resistor of 1kohm to ground. In I2C2 it was around 1V, which meant that the pull-up resistor was around 2k2 (the ones shown in the WB quad revB1 datasheet). Until here everything correct. In I2C1 it was around 2.3V, which meant that the "equivalent pull-up resistor" was around 430 ohm, much below the minimum (1 kohm, figure 2 in page 3). So I decided to remove R113 and R115 to disconnect the DDC and the pull-up resistors R111 and R117.
raulina
 
Posts: 15
Joined: Thu May 05, 2016 3:23 pm


Return to Hardware and peripherals

Who is online

Users browsing this forum: Majestic-12 [Bot] and 15 guests