FRDM K64 - Good way to reset UART

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM K64 - Good way to reset UART

Jump to solution
1,312 Views
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).

Tags (3)
0 Kudos
1 Solution
1,289 Views
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.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
1,290 Views
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 Kudos
1,269 Views
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 Kudos
1,259 Views
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 Kudos