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?
已解决! 转到解答。
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.
Regards,
Daniel
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
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?
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.
Regards,
Daniel