S32k144 LIN checksum always in classic mode when enhanced was selected

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

S32k144 LIN checksum always in classic mode when enhanced was selected

Jump to solution
1,750 Views
ruihang_wu
Contributor III

I am using a S32K144 EVB as a LIN slave. I am using Vector Canalyzer to send 5 different LIN messages. Two for sending data to the EVB, and 3 for requesting data from the EVB.

The issue I'm seeing is the checksum on the response from the EVB is always calculated in classic mode no matter what option I pick in the LIN config block. I need the checksum to be in enhanced mode. The data itself in the message from the EVB are correct.

 

ruihang_wu_0-1661536933326.png

 

 

It can be best seen in the message with ID 4. The data bytes are all 0 so the classic checksum is 255 but the enhanced checksum would take into account the PID and the checksum should be 59

It can also be confirmed with a LIN checksum calculator here: https://linchecksumcalculator.machsystems.cz/

 

I have went through the "intro to LIN block" training here:

https://www.nxp.com/design/training/introducing-the-lin-communication-blocks-of-the-nxp-mbdt:TIP-INT...

And I noticed in that video at 23:43 the checksum type is selected as enhanced and at 25:47 the PLIN viewer shows the received checksum as classic

ruihang_wu_1-1661536062362.png

 

I have attached a model with just the LIN portion responding with constant data.

 

My system layout

Hardware: S32K144 EVB, Vector CANalyzer

Software: MATLAB Version 9.7 (R2019b), Simulink Version 10.0 (R2019b), Model-Based Design Toolbox for S32K1xx Series Version 4.2.0 (R2016a-R2020a)

0 Kudos
1 Solution
1,489 Views
stefancinipeanu
NXP Employee
NXP Employee

Hello, @ruihang_wu 

I apologize for the late response. I have investigated the problem regarding the checksum value in enhanced mode for LIN communication and it looks like a problem in the SDK for the LIN driver. The function that computes the checksum should take all data bytes and add them modulo 256 together. In enhanced mode also the PID should be took in this computation. But the SDK function ignores the PID in classical and also in enhanced mode.

I have modified a source file that contains the function that computes the checksum. You can test the functionality by copying the file into "{toolbox_path}\src\S32_Platform_SDK\platform\drivers\src\lpuart". Then try to build your application as usual. 

Let me know if it works.

Best regards,

Stefan.

View solution in original post

5 Replies
1,196 Views
andyknitt
Contributor II

I think I found that another workaround to this issue is to actually select the "Classic" checksum type and leave the "Classic PIDs list" at the default "0" value.  Apparently even when "Classic" is selected, only the PIDs in the "Classic PIDs list" use the Classic checksum and all the rest use Enhanced.  Fixing the driver C code is the better solution, but this can work as a quick fix:

andyknitt_0-1676938767278.png

 

0 Kudos
1,433 Views
ruihang_wu
Contributor III

I tried it out and it indeed seem to work. Thank you

0 Kudos
1,614 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @ruihang_wu,

Thank you very much for reporting this! 

@stefancinipeanu started to investigate your reported behavior.

Regards,

Marius

Tags (1)
0 Kudos
1,660 Views
ruihang_wu
Contributor III

Hey has there been any update on this? Has anyone experienced a similar issue or replicated this issue?

 

Thanks

0 Kudos
1,490 Views
stefancinipeanu
NXP Employee
NXP Employee

Hello, @ruihang_wu 

I apologize for the late response. I have investigated the problem regarding the checksum value in enhanced mode for LIN communication and it looks like a problem in the SDK for the LIN driver. The function that computes the checksum should take all data bytes and add them modulo 256 together. In enhanced mode also the PID should be took in this computation. But the SDK function ignores the PID in classical and also in enhanced mode.

I have modified a source file that contains the function that computes the checksum. You can test the functionality by copying the file into "{toolbox_path}\src\S32_Platform_SDK\platform\drivers\src\lpuart". Then try to build your application as usual. 

Let me know if it works.

Best regards,

Stefan.