Project

General

Profile

Interfacing pca9535 with arm using i2c expanders (J5)(i2c5)

Added by Thejas Raj 9 days ago

Hello,

We are trying to interface external pca9535 with the evk via the i2c5 bus. We'll be using the J5 extension on the board to do so.

As far as I know, 0x21 is the memory address that is supposed to be used by pca9535 but i2cdetect -y -r 4 returns

root@mitysom-am57x:~# i2cdetect -y -r 4
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- 47 -- -- -- -- -- -- -- -- 
50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- 
70: -- -- -- -- -- -- -- --             

even when data is coming from pca9535. I suppose the 20 1 column should show 21, but it is not coming up.

Kindly elaborate on the necessary changes to be made in the dtsi files and any other changes that should be made for the proper interface.

Thanks in advance


Replies (7)

RE: Interfacing pca9535 with arm using i2c expanders (J5)(i2c5) - Added by Jonathan Cormier 9 days ago

even when data is coming from pca9535. I suppose the 20 1 column should show 21, but it is not coming up.

What does this mean? How is data coming from the pca9535 if you cannot talk to it?

As far as I know, 0x21 is the memory address that is supposed to be used by pca9535 but i2cdetect -y -r 4 returns

What are the address A0, A1, A2 pins set to? The i2c address should be 0x20-0x27 depending.

Did you make sure to hook it up to the 3.3V side?

RE: Interfacing pca9535 with arm using i2c expanders (J5)(i2c5) - Added by Thejas Raj 7 days ago

Sorry for the late reply.

We were able to interface the pca9535 after adding the respective nodes for it in the i2c5 bus configuration in the am57xx-mitysom-baseboard.dts file.
Will update if anything else comes up.

Thank you

RE: Interfacing pca9535 with arm using i2c expanders (J5)(i2c5) - Added by Thejas Raj 2 days ago

Hi,

So we were able to interface i2c5 of the evk with our pca 9535 i2c device.

As of now we also require i2c4 of the evk/som whose scl and sda are currently muxed to gpio7_3 (R6) and gpio7_4 (T9) respectively.
Can you give us the procedure using which we could access the i2c4 peripheral from the kernel side as it is not enabled by default?
Any changes that should be made in the kernel dts files?

RE: Interfacing pca9535 with arm using i2c expanders (J5)(i2c5) - Added by Jonathan Cormier 2 days ago

Thejas Raj wrote in RE: Interfacing pca9535 with arm using i2c expanders (J5)...:

Hi,

So we were able to interface i2c5 of the evk with our pca 9535 i2c device.

As of now we also require i2c4 of the evk/som whose scl and sda are currently muxed to gpio7_3 (R6) and gpio7_4 (T9) respectively.

First please note that the R6/T9 pins will be 1.8V logic level. If your device is 3.3V logic level you will need a voltage translator similar to U5 on the devkit.

Can you give us the procedure using which we could access the i2c4 peripheral from the kernel side as it is not enabled by default?
Any changes that should be made in the kernel dts files?

  1. Update the pinmux in u-boot U-Boot_Setup_Pinmux
    I don't think you ever mentioned if you were using an fpga or non-fpga module so I updated both muxes.
    diff --git a/board/cl/mitysom-57x/mux_data.h b/board/cl/mitysom-57x/mux_data.h
    index d6928f064f0c..8897e037d3e7 100644
    --- a/board/cl/mitysom-57x/mux_data.h
    +++ b/board/cl/mitysom-57x/mux_data.h
    @@ -29,8 +29,8 @@ static const struct pad_conf_entry core_padconf_array_essential_mitysom_devkit[]
            {GPMC_AD13, (M0 | PIN_INPUT)},  /* J3 gpmc_ad13.gpmc_ad13 */
            {GPMC_AD14, (M0 | PIN_INPUT)},  /* H2 gpmc_ad14.gpmc_ad14 */
            {GPMC_AD15, (M0 | PIN_INPUT)},  /* H3 gpmc_ad15.gpmc_ad15 */
    -       {GPMC_A0, (M14 | PIN_INPUT_PULLDOWN)},  /* R6 gpmc_a0.gpio7_3 J11.17 */
    -       {GPMC_A1, (M14 | PIN_INPUT_PULLDOWN)},  /* T9 gpmc_a1.gpio7_4 J11.16 */
    +       {GPMC_A0, (M7 | PIN_INPUT)},    /* R6 gpmc_a0.i2c4_scl J11.17 */
    +       {GPMC_A1, (M7 | PIN_INPUT)},    /* T9 gpmc_a1.i2c4_sda J11.16 */
            {GPMC_A2, (M14 | PIN_INPUT_PULLDOWN)},  /* T6 gpmc_a2.gpio7_5 J11.13 */
            {GPMC_A3, (M14 | PIN_INPUT_PULLDOWN)},  /* T7 gpmc_a3.gpio7_6 J11.11 */
            {GPMC_A4, (M7 | PIN_INPUT)},    /* P6 gpmc_a4.i2c5_scl */
    @@ -304,8 +304,8 @@ static const struct pad_conf_entry core_padconf_array_essential_mitysom_nonfpga_
            {GPMC_AD13, (M14 | PIN_INPUT)}, /* J3 gpmc_ad13.gpio1_19 LA32_N SOM:sysboot_pulldown */
            {GPMC_AD14, (M14 | PIN_INPUT)}, /* H2 gpmc_ad14.gpio1_20 HA02_P SOM:sysboot_pulldown */
            {GPMC_AD15, (M14 | PIN_INPUT)}, /* H3 gpmc_ad15.gpio1_21 LA32_P SOM:sysboot_pullup */
    -       {GPMC_A0, (M14 | PIN_INPUT_PULLDOWN)},  /* R6 gpmc_a0.gpio7_3 J11.17 */
    -       {GPMC_A1, (M14 | PIN_INPUT_PULLDOWN)},  /* T9 gpmc_a1.gpio7_4 J11.16 */
    +       {GPMC_A0, (M7 | PIN_INPUT)},    /* R6 gpmc_a0.i2c4_scl J11.17 */
    +       {GPMC_A1, (M7 | PIN_INPUT)},    /* T9 gpmc_a1.i2c4_sda J11.16 */
            {GPMC_A2, (M14 | PIN_INPUT_PULLDOWN)},  /* T6 gpmc_a2.gpio7_5 J11.13 */
            {GPMC_A3, (M14 | PIN_INPUT_PULLDOWN)},  /* T7 gpmc_a3.gpio7_6 J11.11 */
            {GPMC_A4, (M7 | PIN_INPUT)},    /* P6 gpmc_a4.i2c5_scl */
    
  1. Update the kernel device tree Linux_Kernel
    Doing this from yocto is briefly covered here. Linux_Kernel_Yocto_for_MitySOM-AM57X
    In am57xx-mitysom-baseboard.dtsi, add:
    &i2c4 {
        status = "okay";
        clock-frequency = <400000>;
    };
    

RE: Interfacing pca9535 with arm using i2c expanders (J5)(i2c5) - Added by Thejas Raj 1 day ago

Thank you

Will update if anything else comes up.

    (1-7/7)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)