Using the M4 as an I2C Slave on an IMX8M

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Using the M4 as an I2C Slave on an IMX8M

跳至解决方案
2,772 次查看
broloff
Contributor II

We are using an IMX8M, we want the M4 to be an I2C slave to another device, but whenever Linux boots up the communication stops.  If we don't boot up the Linux core, the I2C communication works perfectly.  We have turned off the specific I2C bus in the device tree, but the communication still stops when Linux boot up.  Any idea what may be the cause of this?

标签 (2)
0 项奖励
1 解答
2,470 次查看
broloff
Contributor II

Thank you for the help.  We found that moving back to an older kernel version fixed the problem.  We were on kernel 4.14, but by moving back to 4.9 it worked.

在原帖中查看解决方案

0 项奖励
9 回复数
2,470 次查看
diegoadrian
NXP Employee
NXP Employee

Hello,

This is because of the i.MX was programmed to be a master device, it cannot be set as a slave device manually. We do have a patch that will configure the i.MX8M as a slave device. However, this patch was created for the Linux version L4.9.51. I cannot guarantee if this will work for newer Linux versions. In any case, you can use the code and port it to the newer versions.

Hope this information could help you.

Best regards,

Diego.

0 项奖励
2,325 次查看
lquinet
Contributor I

Hi @diegoadrian ,

Could you tell me what on which linux kernel this patch was created for? I tried applying this patch on 3 different repos (freescale / nxp and mainline kernels) on the kernel v4.9.51 and all failed (there were some conflicts or didn't apply at all):

- https://source.codeaurora.org/external/imx/linux-imx/tag/?h=v4.9.51

- https://github.com/Freescale/linux-fslc/releases/tag/v4.9.51

- https://github.com/torvalds/linux/releases/tag/v4.9

0 项奖励
2,470 次查看
broloff
Contributor II

We are not trying to use Linux for the I2C communication.  We are trying to use the M4 core with an RTOS on it for the I2C communication, which is able to be used as a slave.  How is the Linux A53 core overriding the M4 core?

0 项奖励
2,470 次查看
diegoadrian
NXP Employee
NXP Employee

Hello,

How the A53 core is the principal core, the A53 is the one that is going to use. Probably the problem could be because you have a multi-master conflict between your A53 core and the other device that you have. Try applying the patch and see if that solves the problem.  

Furthermore, can you please pass me your modified device tree. Because disabling the I2C bus could be another solution, but apparently is not being done in your case.

Best regards,

Diego.

0 项奖励
2,470 次查看
broloff
Contributor II

Here is our dts.

0 项奖励
2,470 次查看
diegoadrian
NXP Employee
NXP Employee

Hello,

Just another thing.

Are you testing the I2C slave mode with our SDK?

Best regards,

Diego.

0 项奖励
2,470 次查看
broloff
Contributor II

Yes, I am using the NXP SDK and using the slave portion of the I2C RTOS example.

0 项奖励
2,470 次查看
diegoadrian
NXP Employee
NXP Employee

Hello,

Another question, are you disabling the I2C bus 2 for the cortex M4 dtb?

Furthermore, I recommend you to disable every driver that makes use of the I2C bus 2 since how the cortex A53 has priority over the cortex M4 even if is disabled in the device tree, the kernel will try to use the drivers. The other solution is to apply the patch that I provided you previously. 

Best regards,

Diego.

0 项奖励
2,471 次查看
broloff
Contributor II

Thank you for the help.  We found that moving back to an older kernel version fixed the problem.  We were on kernel 4.14, but by moving back to 4.9 it worked.

0 项奖励