FRDM K64 - Good way to reset UART

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

FRDM K64 - Good way to reset UART

跳至解决方案
1,311 次查看
darshan_shah1
Contributor II

Hi,

I am using FRDM K64 and UART EDMA example code to communicate with BG95 modem over UART.

I would like to reset UART communication with BG95. What is the good way to execute this?

I just tried to reset the modem(not UART), yet after this I am not receiving any data from modem (TX is working fine).

标记 (3)
0 项奖励
1 解答
1,288 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

 

Hi darshan_shah1,

  If you want to reset the UART module, you can deinit it, then init it again, you can find the code in the K64 SDK fsl_uart.c:

 

void UART_Deinit(UART_Type *base)
{
#if defined(FSL_FEATURE_UART_HAS_FIFO) && FSL_FEATURE_UART_HAS_FIFO
    /* Wait tx FIFO send out*/
    while (0U != base->TCFIFO)
    {
    }
#endif
    /* Wait last char shoft out */
    while (0U == (base->S1 & UART_S1_TC_MASK))
    {
    }

    /* Disable the module. */
    base->C2 = 0;

#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
    /* Disable uart clock */
    CLOCK_DisableClock(s_uartClock[UART_GetInstance(base)]);
#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
}

 

Please try it on your side.

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
3 回复数
1,289 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

 

Hi darshan_shah1,

  If you want to reset the UART module, you can deinit it, then init it again, you can find the code in the K64 SDK fsl_uart.c:

 

void UART_Deinit(UART_Type *base)
{
#if defined(FSL_FEATURE_UART_HAS_FIFO) && FSL_FEATURE_UART_HAS_FIFO
    /* Wait tx FIFO send out*/
    while (0U != base->TCFIFO)
    {
    }
#endif
    /* Wait last char shoft out */
    while (0U == (base->S1 & UART_S1_TC_MASK))
    {
    }

    /* Disable the module. */
    base->C2 = 0;

#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
    /* Disable uart clock */
    CLOCK_DisableClock(s_uartClock[UART_GetInstance(base)]);
#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
}

 

Please try it on your side.

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
1,268 次查看
darshan_shah1
Contributor II

@kerryzhou , Thanks for your response. I am using EDMA with ringbuffer so it needs other deinit as well.

Well, I got the sequence.

Thank you.

0 项奖励
1,258 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi darshan_shah1,

  Thanks for letting me know your updated situation.

   If you have any new question in the future, welcome to create the new question post in the community.

 

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

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

Note:

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

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

0 项奖励