mpc5744p: LIN communication questions

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

mpc5744p: LIN communication questions

604 Views
Shibo_Liu
Contributor I

Hello, I am using #mpc5744p board.

I want to realize the function of CAN communication and LIN communication.

I completed the CAN communication part in the MBDT toolkit, called program A, but because there is no LIN module in the toolkit, I copied the S32DS example program to complete LIN communication in S32DS, called program B. And I successfully imported the program A generated by MBDT into S32DS. But I'm having trouble putting LIN program B into auto-generated program A.

With some effort (mainly adding LINmodule and changing the auto-generated DEBUG_CAN_LIN.c), I was able to get LINFlexD_1 initialized. However, when communicating with LIN, I will encounter problems here.

“LINFlexD_1.LINCR2.B.HTRQ = 1; /* Request header transmission */”

I have attached my simulink program and S32DS project. I have spent a lot of efforts but still have not solved the problem, please help me.Thanks a lot.

0 Kudos
Reply
1 Reply

578 Views
Bryant6
Contributor I

I'd be happy to help you with your CAN and LIN communication integration in your MPC5744P project.

From your description, it seems that you have two separate programs: Program A for CAN communication developed using the MBDT toolkit, and Program B for LIN communication developed using S32DS. Now, you want to integrate Program B (LIN communication) into Program A (CAN communication). uspayserv.com

To properly integrate the LIN communication into your auto-generated Program A, you'll need to make sure that the LINFlexD module is configured correctly and that the LIN frame transmission and reception are properly synchronized with the CAN communication.

Here are the general steps you can follow to integrate the LIN communication into your MPC5744P project:

1. **Check Hardware Configuration:**
Ensure that the MPC5744P board supports both CAN and LIN communication and that the necessary pins and connections are set up correctly for both communication protocols.

2. **Initialize LINFlexD Module:**
In your auto-generated Program A, make sure that you correctly initialize the LINFlexD module (LINFlexD_1) for LIN communication. This includes configuring the appropriate registers for baud rate, frame format, and other LIN-specific settings.

3. **LIN Frame Transmission:**
Implement the LIN frame transmission process in Program A using LINFlexD_1. This includes setting up the LIN header and data, initiating frame transmission, and handling LIN frame events.

4. **LIN Frame Reception:**
Implement the LIN frame reception process in Program A using LINFlexD_1. This includes setting up the LIN header and data reception, handling LIN frame reception events, and processing received data.

5. **Synchronize CAN and LIN Communication:**
If you need both CAN and LIN communication to work simultaneously, ensure that their communication cycles are synchronized properly. Both protocols have different frame structures and timing requirements, so it's essential to coordinate their operations to avoid conflicts.

6. **Debugging and Testing:**
Test the integrated Program A with both CAN and LIN communication in real-world scenarios. Use appropriate debugging tools and techniques to identify and resolve any issues that may arise during testing.

As integrating CAN and LIN communication can be complex, it's essential to thoroughly review your code and the hardware configuration to ensure everything is set up correctly. Additionally, take advantage of debugging tools provided by S32DS to diagnose any issues during runtime.

Since you have already attached your Simulink program and S32DS project, I recommend reviewing the LINFlexD_1 initialization and the section where you encounter the problem with "LINFlexD_1.LINCR2.B.HTRQ = 1" to identify any potential issues or misconfigurations.

If you encounter specific errors or issues during the integration process, please provide more details, and I'll do my best to assist you further. Good luck with your project!

0 Kudos
Reply