S32K344 - Lin communication between Peak LIN and MCU

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

S32K344 - Lin communication between Peak LIN and MCU

Jump to solution
1,510 Views
sandeep_j
Contributor II

Hi Everyone,

Iam using the S32K344 MCU in my project and I have managed to start LPUART communication from the MCU to my PC using the Lin_MasterFrameTransfer_S32K344 example. I was successful in transferring LIN frames from the MCU to the PC.

However iam unable to send frames from my PC (Master) and the MCU (Slave) using Peak-LIN. I see my messages are getting Echoed in the Peak Lin but iam unable to find any code or configurations regarding how to receive data from the PC to the MCU.

i have tried some of the examples that were available in the AUTOSAR 4.4 - R21-11 RTD 3.0.0

Iam just a beginner here. Please point me in the right direction.

Thanks

Tags (2)
0 Kudos
Reply
1 Solution
1,345 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1) if S32K344EVB is used, or custom board with similar HW connection, then so changes are needed. Just open example, and do code update, build and download into MCU sucessfully.
Not sure of the RTD and stack version you have, but I tried the one in RTD4.0.0, stack 2.0.4 and the only steps I did was
-mex file modification in external editor before opening in S32DS, search for src\LIN21.ldf and change it to src/LIN21.ldf
- during code update allow changes for generated LinIf.h and LInIf.c as described in LINStack user manual chapter 6 Known issues and limitations
Then project can be built and elf generated

2) in PCAN LIN you need to load ldf file from project, select Master node and then select and run Schedule Table from that ldf file. YOu can read PLIN VIew manual for more info.

3) I got similar errors in S32DS, however elf was succesfully generated. YOu can try to clean project, build again and/or close/reopen S32DS.

BR, Petr

View solution in original post

0 Kudos
Reply
8 Replies
1,458 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

so do you want to add receive part into that master example? Means master is sending header and Peak-LIN responds with payload.

Or you would like to rather have LIN slave demo, where Peak-LIN is initiating frames and K344 respond accordingly, receive payload or respond to request?

BR, Petr

0 Kudos
Reply
1,446 Views
sandeep_j
Contributor II

Hi Peter,

Thanks for your response.

I would like to have an example or code of a LIN slave demo where MCU responds according to the Frames sent from the Peak LIN. 

Thanks

0 Kudos
Reply
1,392 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

there are two RTD demos you can refer to, where LPUART is used as LIN Slave
"Lin_Ip_FrameTransfer_S32K344"...  simple application which shows a communication between a Lin Master and a Lin Slave of both Lpuart Ip and Flexio Ip 
- "Lin_Slave_S32K344_Example_DS" ... LINStack example demonstrating the LIN communication between S32K344 Slave and other board Master using unconditional frames.

PetrS_2-1722255524512.png

BR, Petr

0 Kudos
Reply
1,381 Views
sandeep_j
Contributor II

Hi,

Thanks for the examples.

Iam going ahead with the Lin_Slave_S32K344_Example_DS from the Linstack. Instead of the Master in another board, I want to use Peak LIN as master. 

1. What are the changes that i need to make ?

2. Can you provide me step wise instructions on what i need to do to make it communicate with Peak LIN 

3. Iam getting multiple errrors like the parameter McuClockSettingConfig_0 could not be resolved. I did not make any changes in peripheral except for changing the LPUART5 to LPUART1 and adding couple of Dio pins

sandeep_j_0-1722277288997.png

I also made sure that the Update_code is done

sandeep_j_1-1722277340751.png

thank you so much !!!

0 Kudos
Reply
1,346 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1) if S32K344EVB is used, or custom board with similar HW connection, then so changes are needed. Just open example, and do code update, build and download into MCU sucessfully.
Not sure of the RTD and stack version you have, but I tried the one in RTD4.0.0, stack 2.0.4 and the only steps I did was
-mex file modification in external editor before opening in S32DS, search for src\LIN21.ldf and change it to src/LIN21.ldf
- during code update allow changes for generated LinIf.h and LInIf.c as described in LINStack user manual chapter 6 Known issues and limitations
Then project can be built and elf generated

2) in PCAN LIN you need to load ldf file from project, select Master node and then select and run Schedule Table from that ldf file. YOu can read PLIN VIew manual for more info.

3) I got similar errors in S32DS, however elf was succesfully generated. YOu can try to clean project, build again and/or close/reopen S32DS.

BR, Petr

0 Kudos
Reply
1,335 Views
sandeep_j
Contributor II

Hi,

Thanks for the brief steps. Appreciated !

Yes Iam using RTD 4.0.0 with 2.0.4 Lin Stack and it is a custom board with S32K344 chip.

But without making any changes, when i compile the project, as per the LINStack user manual chapter 6 Known issues and limitations, I clicked "Compare" and "Copy all Non-Conflicting changes" and "commit"

sandeep_j_0-1722356273462.png

sandeep_j_1-1722356301069.png

i seem to get these errors:

sandeep_j_2-1722356492228.png

Please advise. Thank you

0 Kudos
Reply
1,323 Views
sandeep_j
Contributor II

Update:

I chose "keep existing" and my code compiled successfully. I loaded the LDF file in Peak LIN and my Peak LIN reads the current motor temperature as 30 (HEX: 1E) as seen in the image.

sandeep_j_0-1722366440566.png

 

There are specific parts in the code that seem to rise and lower temperature as shown below. How am i supposed to change the temperature / call the function. Is there any LIN command that i need to send from my Peak LIN ? 

sandeep_j_1-1722366465818.png

 

 

0 Kudos
Reply
1,300 Views
sandeep_j
Contributor II

Update:

Got it figured out .

Thanks for the help @PetrS 

Thanks

0 Kudos
Reply