Hello,
I have used toradex apalis imx8 customize board. I want to use I2C port for the M4 core [ M41_I2C_SDA and M41.I2C_SCL lines of Pin number 122 and 124 respectively ].
What do I changes in the device tree file and which file ?
How to configure this pin in device tree and What is the I2C bus number of this I2C lines in I2Cdetect tool ?
Please give us solution on this issue as soon as possible.
Hi @dipakshetye,
These pins are defined inside imx8-apalis-v1.1.dtsi:
/* Apalis UART1_ */
pinctrl_lpuart1ctrl: lpuart1ctrlgrp {
fsl,pins = <
/* Apalis UART1_DTR */
IMX8QM_M40_I2C0_SCL_LSIO_GPIO0_IO06 0x00000021
/* Apalis UART1_DSR */
IMX8QM_M40_I2C0_SDA_LSIO_GPIO0_IO07 0x00000021
/* Apalis UART1_DCD */
IMX8QM_M41_I2C0_SCL_LSIO_GPIO0_IO10 0x00000021
/* Apalis UART1_RI */
IMX8QM_M41_I2C0_SDA_LSIO_GPIO0_IO11 0x00000021
>;
};
Which are assigned to the iomuxc node:
pinctrl-0 = <&pinctrl_cam1_gpios>, <&pinctrl_dap1_gpios>,
<&pinctrl_esai0_gpios>, <&pinctrl_fec2_gpios>,
<&pinctrl_gpio3>, <&pinctrl_gpio4>, <&pinctrl_gpio_keys>,
<&pinctrl_gpio_usbh_oc_n>, <&pinctrl_lpuart1ctrl>,
<&pinctrl_lvds0_i2c0_gpio>, <&pinctrl_lvds1_i2c0_gpios>,
<&pinctrl_mipi_dsi_0_1_en>, <&pinctrl_mipi_dsi1_gpios>,
<&pinctrl_mlb_gpios>, <&pinctrl_qspi1a_gpios>,
<&pinctrl_sata1_act>, <&pinctrl_sim0_gpios>,
<&pinctrl_usdhc1_gpios>;
To disable them, you can remove the group from the iomuxc node:
diff --git a/arch/arm64/boot/dts/freescale/imx8-apalis-v1.1.dtsi b/arch/arm64/boot/dts/freescale/imx8-apalis-v1.1.dtsi
index 0ece42889af8..631aa3d5d493 100644
--- a/arch/arm64/boot/dts/freescale/imx8-apalis-v1.1.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8-apalis-v1.1.dtsi
@@ -421,7 +421,7 @@
pinctrl-0 = <&pinctrl_cam1_gpios>, <&pinctrl_dap1_gpios>,
<&pinctrl_esai0_gpios>, <&pinctrl_fec2_gpios>,
<&pinctrl_gpio3>, <&pinctrl_gpio4>, <&pinctrl_gpio_keys>,
- <&pinctrl_gpio_usbh_oc_n>, <&pinctrl_lpuart1ctrl>,
+ <&pinctrl_gpio_usbh_oc_n>,
<&pinctrl_lvds0_i2c0_gpio>, <&pinctrl_lvds1_i2c0_gpios>,
<&pinctrl_mipi_dsi_0_1_en>, <&pinctrl_mipi_dsi1_gpios>,
<&pinctrl_mlb_gpios>, <&pinctrl_qspi1a_gpios>,
This can be done with the device tree or with a device tree overlay, it’s up to you.
I’m not sure they will be visible under I2CDetect since they’re under the M41 domain. Unless you connect the I2C from the M4 to one of the I2C lines of the Cortex-A. In this case, it will appear under the I2C you connected.
Best Regards,
Hiago.
Thank you for reply.
How to check the this I2C bus working?
I connected M41_I2C0_SCL and M41_I2C0_SDA lines to our slave device but let us know how test this bus ?
Please send me the command to check the slave address and read/write data.
Hello,
Please update on this issue.
Hi @dipakshetye ,
Please download the SDK as mentioned here. Inside the SDK you will find various demos including how to use I2C and documentation on how to run examples on your MCU.
I would suggest you to first test by running the hello_world demo. This will confirm that the MCU is up and running.
For pins that you want to use with your MCU, you need to first disable it from the device tree if the pins are already occupied.
You can use device tree overlays to do that.
Let me know if this helps.
Hello,
Thanks for your reply.
I configured the I2 port for the M4 core in device tree as per your suggestion.
I connected this I2C port lines to my other slave device, now I want to test this I2C port is working or not.
Please send me the test code to test this lines and what is the filename of this I2C port like “/dev/i2c-xx” ?
Please send me the sample test for this.
Hi @dipakshetye ,
You need to download the demos from the nxp website . You need to select your SDK as mentioned here (see “get the freeros source code”).
Again, I will suggest you to first run a hello-world demo on your mcu before running I2C demo
Thank you for your reply.
I download the SDK from link given by you but I have some confusion which application I have use for test I2C 2 port for the M4 core ?
Can you share me the proper steps to test I2C port using SDK application ?
Hi @dipakshetye ,
The demos are inside the SDK package.
eg hello_world demo
SDK\boards\mekmimx8qm\demo_apps\hello_world
i2c_Demos
SDK\boards\mekmimx8qm\driver_examples\lpi2c
SDK\boards\mekmimx8qm\rtos_examples
Documentation
SDK\docs
Please understand that there can not be 2 seperate demo for I2C1 and I2C2. its the pin configuration you need to change accordingly.
note : demos are not developed and tested by toradex