S32K311 Lpuart_Lin Slave always returns RX_HEADER_ERROR / RX_OVERRUN_ERROR

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32K311 Lpuart_Lin Slave always returns RX_HEADER_ERROR / RX_OVERRUN_ERROR

跳至解决方案
2,725 次查看
johns_chuang
Contributor III

Dear Team,

We are trying to enable the Lpuart_Lin (Slave) functionality on the S32K311, and we are referencing the example Lin_Ip_FrameTransfer_S32K344, using Lpuart_Lin_Ip_Init and Lpuart_Lin_Ip_GetStatus.

After the Master transmits a LIN frame:
[0x00, 0xFF, 0x80, 0x11, 0x6E]

The return status from Lpuart_Lin_Ip_GetStatus remains stuck at LPUART_LIN_IP_STATUS_RX_HEADER_ERROR.

Additionally, in the interrupt callback LpuartSlaveCallback, the status is always LPUART_LIN_IP_RX_OVERRUN_ERROR.

Do you have any suggestions on what we should check, or recommended changes we could try?

Thank you in advance for your support.

Best,

Johns

标记 (3)
0 项奖励
回复
1 解答
2,586 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @johns_chuang,

I finally managed to reproduce the issue during testing.

It turns out the problem was not related to the clock configuration after all.

I was able to replicate the issue on my EVB. To do so, I had to switch the LIN hardware to UART2 (PTD6, PTD7).

Once I removed all custom interrupt handling, the communication started working correctly.

 

danielmartynek_0-1752146622977.png

These are the changes: 

danielmartynek_1-1752146674941.png

You need to select the handler from Lpuart_Lin_Ip_Irq.c

danielmartynek_2-1752146718615.png

 

Regards,

Daniel

 

 

在原帖中查看解决方案

10 回复数
2,587 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @johns_chuang,

I finally managed to reproduce the issue during testing.

It turns out the problem was not related to the clock configuration after all.

I was able to replicate the issue on my EVB. To do so, I had to switch the LIN hardware to UART2 (PTD6, PTD7).

Once I removed all custom interrupt handling, the communication started working correctly.

 

danielmartynek_0-1752146622977.png

These are the changes: 

danielmartynek_1-1752146674941.png

You need to select the handler from Lpuart_Lin_Ip_Irq.c

danielmartynek_2-1752146718615.png

 

Regards,

Daniel

 

 

2,488 次查看
johns_chuang
Contributor III
Hi Daniel, Do you know why I can only read the first byte? The BUFFER_SIZE in LinLpuartPdu is set to 3, but I’m only able to read the first byte — the remaining two bytes are both 0.
0 项奖励
回复
2,483 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @johns_chuang,

Please create a new thread and describe it in details.

0 项奖励
回复
2,710 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @johns_chuang,

The RX_HEADER_ERROR you're encountering is likely due to a timing mismatch..

Have you had a chance to measure the LIN signal using an oscilloscope? 

 

I reviewed the system clock configuration in your test project and noticed that it is not set up correctly.

 

danielmartynek_1-1751445179432.png

 

If you want to have CORE_CLK = 48MHz, use Option D - Low-Speed Run mode (CORE_CLK @ 48 MHz), RM rev10, Table 162.

danielmartynek_0-1751445151989.png

 

Thank you,

BR, Daniel

0 项奖励
回复
2,707 次查看
johns_chuang
Contributor III

Hi Daniel,

Sorry, I’m still getting used to the S32DS interface.
Could you please explain in more detail what you meant by the system clock error?
How should I correctly configure it to 48 MHz?

Currently, I’m trying to receive 1 byte of LIN data:

LeCroy3.jpg

 

Eventually, I plan to work with 8 bytes of LIN data:

LeCroy4.jpg

 


Thank you for your support.

Best,

Johns

0 项奖励
回复
2,697 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @johns_chuang,

Before we can proceed further, the system clock configuration must be corrected - use the S32DS GUI (configuration tool).

Please note that NXP does not guarantee the functionality of the MCU if the ratios between the system clock domains deviate from an approved configuration. Using unsupported clock settings may lead to unpredictable behavior.

danielmartynek_0-1751461552906.png

If your target is to run CORE_CLK at 48 MHz, you must configure all system clocks according to Table 162, Option D – Low-Speed Run mode (as per RM Rev. 10). 

 

Thank you,

BR, Daniel

 

0 项奖励
回复
2,664 次查看
johns_chuang
Contributor III

Hi Daniel,

Clock has been fixed, but the issue still persists. Could you kindly advise what I should check next? 

Thank you again for your support.

johns_chuang_0-1751508607543.png

 

MCU:S32K311

S32DS ver. 3.6.2

SDK:RlatformSDK_S32K3_S32K311_M7 v5.0.0

 

Best,

Johns

0 项奖励
回复
2,614 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @johns_chuang,

I'm sorry for the delay.

What is the baud rate of the LIN signal? Can you measure that?

Also, can you share the LPUART_0 registers after initialization?

 

Thank you,

BR, Daniel

0 项奖励
回复
2,611 次查看
johns_chuang
Contributor III

Hi Daniel,

The LIN baud rate is 19200 bps.

Are you referring to the LPUART_0 registers shown in this image?

johns_chuang_0-1751969979358.png

 

Thank you for your help.

Best,

Johns

0 项奖励
回复
2,718 次查看
johns_chuang
Contributor III

Sorry, Sync was wrong. Correct LIN signal: [0x00, 0x55, 0x80, 0x11, 0x6E], ID is 0x00.

0 项奖励
回复