Lin slave goes into LPUART_FRAME_ERR,How to solve it?

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

Lin slave goes into LPUART_FRAME_ERR,How to solve it?

ソリューションへジャンプ
1,364件の閲覧回数
ericguo
Contributor I

When i use the Lin slave project example form S32K lib, it will step into LPUART_FRAME_ERR, as follows:

void LIN_LPUART_DRV_IRQHandler(uint32_t instance)
{...

...

/* If Framing Error has been detected */
if (LPUART_GetStatusFlag(base, LPUART_FRAME_ERR))
{
/* Clear Framing Error Interrupt Flag */
(void)LPUART_ClearStatusFlag(base, LPUART_FRAME_ERR);

/* Read dummy to clear LPUART_RX_DATA_REG_FULL flag */
LPUART_Getchar(base, &tmpByte);

 

}

How to find the root cause about this error?

 

0 件の賞賛
返信
1 解決策
1,327件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Sorry for the late response.

But I have difficulties to understand it.

Can you please elaborate?

Do you mean the delay between the first edge of the TX pin and the PTA pin?

If so, these operations are not synchronized.

The LPUART_Putchar() function puts the char into the TX DATA register but the char is transfer into the shift register only once the shift register is empty.

danielmartynek_0-1612969580312.png

 

Regards,

Daniel

 

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,352件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hello,

The Framing error is described in the description of the STAT_FE flag:

"FE is set whenever the next character to be read from the DATA register was received with logic 0 detected where a stop bit was expected."

It is also set when a break character is received.

 

BR, Daniel

 

0 件の賞賛
返信
1,346件の閲覧回数
ericguo
Contributor I

Hi,Daniel

Your are correct!when i use oscilloscope to analysis it. i found it as you says above.
I use toggle pin to find the root cause 

status_t LIN_LPUART_DRV_SendFrameData(uint32_t instance,
const uint8_t * txBuff,
uint8_t txSize)
{

......

/* Start sending data */
LPUART_Putchar(base, *linCurrentState->txBuff);

//Toggle Pin here

PINS_GPIO_TogglePins(PTA,0x01 )

}

Use two chanels to measure Tx pin and PTA0, Result:

Most time, Tx pin will delay about1/3 to 1 bit time, then start data output; it make Rx pin miss the stop bit, and lead to frame error as above.

Several times,Tx pin will start data output immediately; Frame received correctly.

I find the root cause, but have no idea to solve it. can you give me some suggestion?

 

0 件の賞賛
返信
1,328件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Sorry for the late response.

But I have difficulties to understand it.

Can you please elaborate?

Do you mean the delay between the first edge of the TX pin and the PTA pin?

If so, these operations are not synchronized.

The LPUART_Putchar() function puts the char into the TX DATA register but the char is transfer into the shift register only once the shift register is empty.

danielmartynek_0-1612969580312.png

 

Regards,

Daniel

 

 

 

0 件の賞賛
返信