I am writing a program that executes CAN control on the Cortex-M7 of the EPC-R3720.
\mcuxsdk-2.12.0\examples\evkmimx8mp\driver_examples\flexcan
\mcuxsdk-2.12.0\examples\evkmimx8mp\driver_examples\canfd
I installed the above sample code on the M7 and checked the connection (PEAK IPEH), but the connection is not complete.
The Linux side is the same as when it was shipped (Linux imx8mprsb3720a1),
but do I need to change the device tree or something?
@Jems_Cheng
Thank you for contacting us.
I am able to run the M7 program, but do you have any information necessary to create a program to control the CAN controller (CAN1/CAN2)?
I can currently transmit via CAN2, but am unable to receive.
There is no information to create a program to control the CAN through M7. We only test by running RPMsg and FreeRTOS with specific steps for loading and debugging but not directly accessing CAN control.
For running RPMsg, there is a need to include a specific Device Tree Blob (DTB) file, as mentioned in the context of running RPMsg on the Cortex-M7.
You might consider a similar approach for CAN control, implying that adjusting or including a specific DTB related to CAN might be necessary if your current setup doesn’t work. Specifically, there was a mention of creating a new DTB file for RPMsg (imx8mp-rsb3720-a1-rpmsg.dtb) by referencing a similar file and then building it for the RSB-3720 for testing.
Sending and receiving via CAN1 (COM/CAN) is working properly, but when sending via CAN2 (UIO-4034), IFLAG1 and IFLAG2 are not set and the completion of transmission cannot be confirmed. If you have any information on the difference between CAN1 and CAN2, please let me know.
@Jems_Cheng
For example, where are the dts and dti files that make up imx8mp-rsb3720-a1-rpmsg.dtb? If I knew where to get them, I think it would be possible to build a new dtb.
@Jems_Cheng
Thank you for providing this information.
I have checked the wiring diagram.
I have also performed unit testing (connecting each port) and confirmed that it works properly.
However, as I mentioned at the beginning of my question, my development environment is a problem that occurs on a Cortex-M7 (IFLAG for CAN2 does not turn ON).
Is it possible to control it with Cortex-M7 (FreeRTOS) in the same way as with Linux?
There is kernel source include rpmsg dts/dtb files have provided for your reference and you might consider a similar approach for CAN control, implying that adjusting or including a specific DTB related to CAN might be necessary if your current setup doesn’t work. Specifically, there was a mention of creating a new DTB file for RPMsg (imx8mp-rsb3720-a1-rpmsg.dtb) by referencing a similar file and then building it for the RSB-3720 for testing.
In the kernel source, it can find the rpmsg dts file for NXP mx8mp evk(imx8mp-rsb3720-a1-rpmsg.dts also based on this dts but change to include the imx8mp-rsb3720-a1.dts):
@Jems_Cheng
Thank you for providing this information.
I tried making the following changes to the decompiled [imx8mp-rsb3720-a1-rpmsg.dtb] using DTC.
can@308c0000 {
/status = “disabled”;/
status = “okey”;
}
I made no changes to can2.
However, the situation remains the same and the IFLAG for CAN2 does not change.
CAN1 can be sent and received from the M7 without any problems.
It seems that what is written in [imx8mp-evk-flexcan2.dts] is reflected in a1-rpmsg.
I’m really in a difficult position.
In previous reply, I provide the information that I copy the rpmsg dts file from NXP mx8mp evk and develop imx8mp-rsb3720-a1-rpmsg.dts for the RSB-3720. The setting is the same with NXP mx8mp evk that only disable flexcan1 in this file. So, you should try to disable flexcan2 for testing in your applications.
@Jems_Cheng
In the “imx8mp-rsb3720-a1.dts” you provided, both can1 and can2 are set to “okay”, so I think that this is a resource setting on the Cortex-A side. Even with this setting, CAN1 can be controlled from the Cortex-M7. Only CAN2 does not have the transmission completion flag (IFLAG) turned ON.
I have also built a DTB, but I am not getting good results.
@Jems_Cheng
Regarding the issue of CAN-2 not working (unable to transmit), let me confirm some basics. The catalog specifications state that CAN-1 is CAN-FD and CAN-2 is CAN2.0B. Can we assume that the control method, port control, interrupt control, MB control, etc. are the same for CAN-1/CAN-2?
@Jems_Cheng
Just to confirm, could you please tell me where the [imx8mp-rsb3720-a1-rpmsg.dts] file is located? Is it the same as [mx8mp-evk-rpmsg.dts]?
For convenient to use, I have provided the imx8mp-rsb3720-a1-rpmsg.dts in this post. you can download it and copy to the kernel source and modify for your application.
@Jems_Cheng
I still haven’t solved the problem with CAN2 transmission. I’ve tried tweaking the DeviceTree, but data is being output. For some reason, when I enable interrupts with (FLEXCAN_EnableMbInterrupts), an interrupt occurs, but the contents of the ESR1 register are [0x20000080], bit 29 is 1. Bit 29 of ESR1 is reserved, so it should not be 1. Bit 7 = 1 indicates IDLE. Why is the reserved bit turned ON? CAN2 is CAN-Bus 2.0B specification, so does it require special settings? I’ve spent a lot of time trying to solve the problem, but I’m still stuck.
The sample I’m using is [mcuxsdk-2.12.0\examples\evkmimx8mp\driver_examples\flexcan\interrupt_transfer].
@Jems_Cheng
Thank you for contacting us.
Please confirm.
About the setting of the Stby signal
[imx8mp-evk.dts]Line954-Line958
[SDK_2_15_000_MIMX8ML8xxxKZ\boards\evkmimx8mp\driver_examples\flexcan\interrupt_transfer] pin_mux.c Line61-65
Is the CAN1-Stby signal set above also valid for the EPC-R3720?
Also, is CAN2-Stby [IOMUXC_SAI2_MCLK_GPIO4_IO27] correct?
It is written in [imx8mp-evk.dts]Line960-964.
Why is both CAN1/2 set to “Disabled” in the DTB? (A5: Is it because the resources are shared with Linux, making the A53 side unavailable?
Compare the imx8mp-rsb3720-a1.dts and imx8mp-evk.dts file.
The CAN1_STBY and CAN2_STBY are not available on RSB-3720.
The “SPDIF_EXT_CLK” has been connect to “UART1_WAKE#” pin: