S32k144 LIN checksum always in classic mode when enhanced was selected

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32k144 LIN checksum always in classic mode when enhanced was selected

ソリューションへジャンプ
2,196件の閲覧回数
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 件の賞賛
返信
1 解決策
1,935件の閲覧回数
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.

元の投稿で解決策を見る

6 返答(返信)
354件の閲覧回数
Even1
Contributor I

Thank you,I had the same problem.The problem has been resolved using your method.

 

0 件の賞賛
返信
1,642件の閲覧回数
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 件の賞賛
返信
1,879件の閲覧回数
ruihang_wu
Contributor III

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

0 件の賞賛
返信
2,060件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello @ruihang_wu,

Thank you very much for reporting this! 

@stefancinipeanu started to investigate your reported behavior.

Regards,

Marius

タグ(1)
0 件の賞賛
返信
2,106件の閲覧回数
ruihang_wu
Contributor III

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

 

Thanks

0 件の賞賛
返信
1,936件の閲覧回数
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.