S32K144: SDK LPUART idle line interrupt support

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

S32K144: SDK LPUART idle line interrupt support

跳至解决方案
2,334 次查看
Joao_Roscoe
Contributor III

As far as I could understand, both S32SDK_S32K1xx_RTM_3.0.0 and S32SDK_S32K14x_RTM_2.0.0 won't support the idle line interrupt - LPUART_INT_IDLE_LINE.

Is that correct?

I need to deal with Rx frames with lengths I don't know in advance. So far, I'm doing that by passing a large Rx buffer and by pooling it's content until I find a complete, consistent frame. It works, but a pure interrupt solution would be cleaner and faster.

What would it take to add LPUART_INT_IDLE_LINE support? Any plans to add it?

Best regards,

Joao

1 解答
2,000 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Joao Roscoe

No, unfortunately, this option is not available in SDK software yet, sorry for the inconveniences that this may cause you. Still, you could add the support of this interrupt in the LPUART_DRV_IRQHandler of the lpiart?driver.c file, here you can create your handler for the specific LPUART_INT_IDLE_LINE interruption.


Have a great day,
TIC

-------------------------------------------------------------------------------
Note: If this post answers your question, please click the "Mark Correct" button. Thank you!

-------------------------------------------------------------------------------

在原帖中查看解决方案

2 回复数
2,001 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Joao Roscoe

No, unfortunately, this option is not available in SDK software yet, sorry for the inconveniences that this may cause you. Still, you could add the support of this interrupt in the LPUART_DRV_IRQHandler of the lpiart?driver.c file, here you can create your handler for the specific LPUART_INT_IDLE_LINE interruption.


Have a great day,
TIC

-------------------------------------------------------------------------------
Note: If this post answers your question, please click the "Mark Correct" button. Thank you!

-------------------------------------------------------------------------------

2,000 次查看
dony
Contributor II

Hi TIC,

   I try to add the LPUART idle line interrupt - LPUART_INT_IDLE_LINE based on S32SDK_S32K1xx_RTM_3.0.0.

  • Firstly, set the CTRL[ILT] and CTRL[IDLECFG]:

LPUART_SetParityMode(base, lpuartUserConfig->parityMode);
LPUART_SetStopBitCount(base, lpuartUserConfig->stopBitCount);

/* Config: 8 idle character(s) must be received before the IDLE flag is set.*/
base->CTRL = (base->CTRL & ~LPUART_CTRL_IDLECFG_MASK) | (3 << LPUART_CTRL_IDLECFG_SHIFT);

/* Idle character bit count starts after stop bit. */
base->CTRL = (base->CTRL & ~LPUART_CTRL_ILT_MASK) | (1 << LPUART_CTRL_ILT_SHIFT);

  • Secondly, enable the CTRL[IDLE] in the function LPUART_DRV_StartReceiveDataUsingInt() or LPUART_DRV_StartReceiveDataUsingDma():

/* Enable LPUART Rx IDLE interrupt */
LPUART_SetIntMode(base, LPUART_INT_IDLE_LINE, true);

  • Lastly, add  handler for the LPUART_INT_IDLE_LINE interruption to the LPUART_DRV_IRQHandler():

/* Handle idle line interrupt */
if (LPUART_GetIntMode(base, LPUART_INT_IDLE_LINE))
{
   if (LPUART_GetStatusFlag(base, LPUART_IDLE_LINE_DETECT))
   {
      LPUART_IdleLineIrqHandler(instance);
   }
}

   After that, it still can not trigger the LPUART_INT_IDLE_LINE interruption when I send a string to the LPUART.

Is it configured correctly? Is there anything that I haven't done?

Have a great day,

Cyril

0 项奖励
回复