Bringup of external I2C device on I2C4-bus in IMX8QM-MEK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bringup of external I2C device on I2C4-bus in IMX8QM-MEK

3,526 Views
emb-vikapat
Contributor II

Hi,

I am trying to add a radio device which support i2c protocol on imx8qm-mek board running Android 9 Automotive. Have added Radio hardware externally by soldering i2c4 pins on board (i.e.:  BB_I2C4_3V3_SCL and BB_I2C4_3V3_SDA) and Radio board too has 3.3v i2c.

But we are facing some issue while detecting the Radio hardware, i am able to detect the Radio device in bootloader using uboot i2c tool but not able to detect it after kernel boot having no acknowledgment coming from the Radio device on I2C4 bus.

Can you guys please help me to solve this issue.

u-boot Logs:

BTO: U-Boot SPL 2018.03-00006-g1c8308dccc (Aug 07 2020 - 18:36:02 +0530)
U
welcome to lk/MP

boot args 0x2000000 0xfe000000 0x2000 0x0
generic_arm64_map_regs: failed -5 name=gic
initializing trusty (Built: 17:00:46 Mar 5 2019)
Initializing Trusted OS SMC handler
int rebuild_hset_all(struct uctx *):238: Rebuilding all handles set
hwcrypto: 222: Initializing
hwrng_caam: 44: Init HWRNG service provider
hwrng_srv: 256: Start HWRNG service
int rebuild_hset_all(struct uctx *):238: Rebuilding all handles set
hwcrypto_caam: 78: Init HWCRYPTO service provider
hwcrypto_srv: 306: Start HWCRYPTO service
hwkey_caam: 169: Init HWKEY service provider
hwkey_caam: 138: Invalid magic
hwkey_srv: 331: Start HWKEY service
hwcrypto: 237: enter main event loop
int rebuild_hset_all(struct uctx *):238: Rebuilding all handles set
int rebuild_hset_all(struct uctx *):238: Rebuilding all handles set
int rebuild_hset_all(struct uctx *):238: Rebuilding all handles set
MMC: FSL_SDHC: 0
In: serial@5a060000
Out: serial@5a060000
Err: serial@5a060000
flash target is MMC:0
libtipc.c: INFO Initializing Trusty device
trusty_dev.c: INFO selected trusty api version: 3 (requested 3)
libtipc.c: INFO Initializing Trusty IPC device
libtipc.c: INFO Initializing RPMB storage proxy service
ss: get_rpmb_auth_key: failed to get key: -2
ss: proxy_connect: can't get storage auth key: (-2)
ipc: do_connect: failure initializing channel state (1001)
rpmb_proxy.c:312: ERROR rpmb_storage_proxy_init: unexpected proxy channel close
libtipc.c:93: ERROR Initlializing RPMB storage proxy service failed (-8)
Authentication key not yet programmed
libtipc.c: INFO Initializing Trusty Hardware Crypto client
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
=>
=>

=> i2c dev 4

Setting bus to 4

=> i2c probe

Valid chip addresses: 11

 

Thanks & regards,

Vikas

0 Kudos
7 Replies

3,293 Views
riyan_khairulin
Contributor I

@igorpadykovI'm still waiting for advice..

0 Kudos

3,460 Views
riyan_khairulin
Contributor I

Hi Vikas, Igor,

I have the same issue, but in my case, I can't see i2c4 even in uboot. I'm using android-automotive-10.0.0_2.2.0.

The SCFW-modification also didn't help

Vikas, can you share your dts files? What did you change to setup i2c4?

0 Kudos

3,436 Views
emb-vikapat
Contributor II

Hi Riyan,

 

You can add following snippet of code in fsl-imx8qm-mek.dts of uboot.

 

for i2c4 node to be enabled:

&i2c4 {
#address-cells = <1>;
#size-cells = <0>;
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpi2c4>;
status = "okay";
};

 

And add pinctrl in node of &iomuxc :

pinctrl_lpi2c4: lpi2c4grp {
fsl,pins = <
SC_P_ENET1_MDC_DMA_I2C4_SCL 0x06000020
SC_P_ENET1_MDIO_DMA_I2C4_SDA 0x06000020
>;
};

 

Make sure that default i2c tool is not enabled for uboot, have to explicitly enable it.

 

Thanks,

Vikas

0 Kudos

3,518 Views
igorpadykov
NXP Employee
NXP Employee

Hi emb-vikapat

 

i2c4 (pad ENET1_MDC ALT1) is used in M4 SDK_MEK-MIMX8QM ,

https://mcuxpresso.nxp.com/en/welcome

One can reassign it to A core partition as in example below where

FlexCAN resources and pads are moved from the M4 partition to the A core partition.

 

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/System-Controller-Firmware-101-Resource-...

 

Best regards
igor

3,476 Views
emb-vikapat
Contributor II

Hi Igor,


Thanks for the reply.

I moved ENET1_MDC and ENET1_MDIO resource to A-core, but we are facing same issue.

If we have assigned this resource to M4 then why we are able to access from uboot.

Below is the code snippet I added in M4 to move the resource:

sc_rm_set_subsys_rsrc_movable(ipc, SC_R_ENET_1, SC_TRUE);

sc_rm_set_resource_movable(ipc, SC_R_ENET_1, SC_R_ENET_1, SC_TRUE);

sc_rm_set_pad_movable(ipc, SC_P_ENET1_MDC, SC_P_ENET1_MDC, SC_TRUE);

sc_rm_set_pad_movable(ipc, SC_P_ENET1_MDIO, SC_P_ENET1_MDIO, SC_TRUE);

sc_err_t sc_rm_move_all(sc_ipc_t ipc, sc_rm_pt_t pt_src, sc_rm_pt_t pt_dst, sc_bool_t move_rsrc, sc_bool_t move_pads);

 

please help me on this.

 

Thanks and Regards,

Vikas

0 Kudos

3,402 Views
riyan_khairulin
Contributor I

Vikas, I argee with you. According dump from SCFW:

*** Resources ***********************************

Partition: 6

...

DMA_0_CH31
I2C_0
I2C_1
I2C_2
I2C_3
I2C_4

...

*** Pads ****************************************

Partition: 6

...

SDHC_2
ENET_0
ENET_1
MLB_0

...

There isn't any reason to move pads or resources. They already located in Partition 6 (A core partition)

But, in my case, I can't still see i2c device in uboot with your dts:

=> i2c dev 4
Setting bus to 4
Failure changing bus number (-38)

 

I would really appreciate some help

0 Kudos

3,375 Views
riyan_khairulin
Contributor I

@igorpadykov 

I found, that imx-kernel 5+ version doesn't contain definition for i2c4 and lpuart4. (According this thread https://community.nxp.com/t5/i-MX-Processors/Linux-BSP-5-4-3-1-0-0-missing-dts-nodes-for-iMX8QM/m-p/...)

I defined i2c4 by myself and it also didn't help. I still can't see any i2c device (voltage level is correct and i2c device is available for imx8qm). On the Linux image for imx8qm with kernel 4.19.42 - i2c4 works well with the same pins configuration. I can send/receive data from i2c4 device.

I believe, the answer from attached thread was incomplete and it is a software issue..So How the missed devices should be defined for imx-kernel 5+ version?

Thanks for considering my request.

0 Kudos