Using the M4 as an I2C Slave on an IMX8M

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

Using the M4 as an I2C Slave on an IMX8M

Jump to solution
2,716 Views
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?

Labels (2)
0 Kudos
1 Solution
2,414 Views
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.

View solution in original post

0 Kudos
9 Replies
2,414 Views
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 Kudos
2,269 Views
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 Kudos
2,414 Views
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 Kudos
2,414 Views
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 Kudos
2,414 Views
broloff
Contributor II

Here is our dts.

0 Kudos
2,414 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Just another thing.

Are you testing the I2C slave mode with our SDK?

Best regards,

Diego.

0 Kudos
2,414 Views
broloff
Contributor II

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

0 Kudos
2,414 Views
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 Kudos
2,415 Views
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 Kudos