S32K1xx LPUART IntCtrl_IP callback function Implement

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

S32K1xx LPUART IntCtrl_IP callback function Implement

Jump to solution
1,559 Views
Pohsuan
Contributor III

Hello NXP Team,

I'm modifying the UART example from S32K1 AUTOSAR R21-11 RTD 2.0.0 P04 D2404 Example Project and want to add a UART RX interrupt callback function.

Currently, I'm using IntCtrl_IP to add the callback function, but it's not working.

UART_IntCTRL_IP.png

Here is my LPUART0_ISR function

void LPUART0_ISR()
{
    const char* pBuffer = "LPUART0_ISR\r\n";
    volatile Lpuart_Uart_Ip_StatusType lpuartStatus = LPUART_UART_IP_STATUS_ERROR;
    uint32 T_timeout = 0xFFFFFF;
    uint32 remainingBytes;
 
    Lpuart_Uart_Ip_AsyncSend(UART_LPUART_INTERNAL_CHANNEL, pBuffer, strlen(pBuffer));
    /* Check for no on-going transmission */
    do
    {
        lpuartStatus = Lpuart_Uart_Ip_GetTransmitStatus(UART_LPUART_INTERNAL_CHANNEL, &remainingBytes);
    } while (LPUART_UART_IP_STATUS_BUSY == lpuartStatus && 0 < T_timeout--);
}

 

 

Or is there any sample code I can refer to?

Thank you!

Tags (1)
0 Kudos
Reply
1 Solution
1,545 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if you want to use driver's interrupt routine and call own callback from it then just configure respective handler in IntCtrl component (here lpuart 6 is shown, use your instance) and add your callback function in Lpuart component

2025-02-07_11-43-35.png2025-02-07_11-43-57.png

Then in your code you add callback and do your need according available events

void Uart_Callback(const uint8 HwInstance, const Lpuart_Uart_Ip_EventType Event, void *UserData)
{
    if(HwInstance == UART_INSTANCE)
    {
    	switch(Event){
    	case LPUART_UART_IP_EVENT_RX_FULL:

    		break;
    	case LPUART_UART_IP_EVENT_TX_EMPTY:

    		break;
    	case LPUART_UART_IP_EVENT_END_TRANSFER:

    		break;
    	case LPUART_UART_IP_EVENT_ERROR:

    		break;
    	case LPUART_UART_IP_EVENT_IDLE_STATE:

    		break;
    	default:
    		break;
    	}
    }



}

 

BR, Petr

View solution in original post

0 Kudos
Reply
5 Replies
1,546 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if you want to use driver's interrupt routine and call own callback from it then just configure respective handler in IntCtrl component (here lpuart 6 is shown, use your instance) and add your callback function in Lpuart component

2025-02-07_11-43-35.png2025-02-07_11-43-57.png

Then in your code you add callback and do your need according available events

void Uart_Callback(const uint8 HwInstance, const Lpuart_Uart_Ip_EventType Event, void *UserData)
{
    if(HwInstance == UART_INSTANCE)
    {
    	switch(Event){
    	case LPUART_UART_IP_EVENT_RX_FULL:

    		break;
    	case LPUART_UART_IP_EVENT_TX_EMPTY:

    		break;
    	case LPUART_UART_IP_EVENT_END_TRANSFER:

    		break;
    	case LPUART_UART_IP_EVENT_ERROR:

    		break;
    	case LPUART_UART_IP_EVENT_IDLE_STATE:

    		break;
    	default:
    		break;
    	}
    }



}

 

BR, Petr

0 Kudos
Reply
1,486 Views
Pohsuan
Contributor III

Hi PetrS

Thanks for your reply

I'm testing the UART callback function by enabling UART loopback mode.

I can receive the UART_Callback event, but the LPUART_UART_IP0_IRQHandler function is not being executed.

I have some questions regarding this setup:

1. Where can I set the LPUART_UART_IP_EVENT_RX_FULL value?

2. If the UART event is triggered, what is the purpose of the LPUART_UART_IP0_IRQHandler function?

3.If UART loopback mode is not enabled and I use another UART TX to send data to the S32K118 RX,

I am unable to receive the LPUART_UART_IP_EVENT_RX_FULL event.

here is my testing function

void sendstring(char* string)
{
    Lpuart_Uart_Ip_AsyncSend(UART_LPUART_INTERNAL_CHANNEL, string, strlen(string));
}

void UART_Callback(const uint8 HwInstance, const Lpuart_Uart_Ip_EventType Event, void *UserData)
{
    if(HwInstance == UART_LPUART_INTERNAL_CHANNEL)
    {
    	switch(Event){
    	case LPUART_UART_IP_EVENT_RX_FULL:

    		sendstring("LPUART_UART_IP_EVENT_RX_FULL\r\n");
    	    ISR_UART = 1;

    		break;
    	case LPUART_UART_IP_EVENT_TX_EMPTY:
    		sendstring("LPUART_UART_IP_EVENT_TX_EMPTY\r\n");

    		break;
    	case LPUART_UART_IP_EVENT_END_TRANSFER:
    		//sendstring("LPUART_UART_IP_EVENT_END_TRANSFER\r\n");

    		break;
    	case LPUART_UART_IP_EVENT_ERROR:
    		sendstring("LPUART_UART_IP_EVENT_ERROR\r\n");

    		break;
    	//case LPUART_UART_IP_EVENT_IDLE_STATE:

    		//break;
    	default:
    		break;
    	}
    }
}
void LPUART_UART_IP0_IRQHandler()
{
	sendstring("LPUART_UART_IP0_IRQHandler\r\n");
}

 

I would greatly appreciate any advice you can provide. Thank you!

0 Kudos
Reply
1,477 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the LPUART_UART_IP0_IRQHandler is assigned nowhere so there is no reason to be called.

1) the Lpuart_Uart_Ip_EventType enum of the Events which can trigger UART callback is defined in lpuart_uart_ip_types.h. 
Teh callback with LPUART_UART_IP_EVENT_RX_FULL event is called when defined number of bytes (specified in AsyncReceive function) was received.

2) the LPUART_UART_IP_0_IRQHandler is driver ISR routine assigned for module interrupt. When byte is received/send this handler is called, byte serviced and user callback is called from there if defined event is achieved.

3) you can check in debugger if driver interrupt is get, means LPUART_UART_IP_0_IRQHandler called. if yes then LPUART_UART_IP_EVENT_RX_FULL would be called as well after defined number of bytes is received.

BR, Petr

0 Kudos
Reply
1,450 Views
Pohsuan
Contributor III

I tried implementing the RX interrupt on both UART0 and UART1,

but I couldn't receive the RX_FULL event for either of them.

Additionally, I encountered a LPUART_UART_IP_EVENT_ERROR on UART1.

Pohsuan_0-1739343799211.png


Could you please help me review my code to check if there's anything incorrectly configured?

I would really appreciate your assistance.

0 Kudos
Reply
1,432 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

do you use own board or EVB? On S32K118EVB you should use different pins then the one selected.

BR, Petr

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2039874%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K1xx%20LPUART%20IntCtrl_IP%20callback%20function%20Implement%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2039874%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20NXP%20Team%2C%3C%2FP%3E%3CP%3EI'm%20modifying%20the%20UART%20example%20from%20S32K1%20AUTOSAR%20R21-11%20RTD%202.0.0%20P04%20D2404%20Example%20Project%20and%20want%20to%20add%20a%20UART%20RX%20interrupt%20callback%20function.%3C%2FP%3E%3CP%3ECurrently%2C%20I'm%20using%20IntCtrl_IP%20to%20add%20the%20callback%20function%2C%20but%20it's%20not%20working.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22UART_IntCTRL_IP.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22UART_IntCTRL_IP.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322880i83F3531A5DD34EAE%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22UART_IntCTRL_IP.png%22%20alt%3D%22UART_IntCTRL_IP.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EHere%20is%20my%20LPUART0_ISR%20function%3C%2FP%3E%3CDIV%3Evoid%20LPUART0_ISR()%3C%2FDIV%3E%3CDIV%3E%7B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20const%20char*%20pBuffer%20%3D%20%22LPUART0_ISR%5Cr%5Cn%22%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20volatile%20Lpuart_Uart_Ip_StatusType%20lpuartStatus%20%3D%20LPUART_UART_IP_STATUS_ERROR%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20uint32%20T_timeout%20%3D%200xFFFFFF%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20uint32%20remainingBytes%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20Lpuart_Uart_Ip_AsyncSend(UART_LPUART_INTERNAL_CHANNEL%2C%20pBuffer%2C%20strlen(pBuffer))%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%2F*%20Check%20for%20no%20on-going%20transmission%20*%2F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20do%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%7B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20lpuartStatus%20%3D%20Lpuart_Uart_Ip_GetTransmitStatus(UART_LPUART_INTERNAL_CHANNEL%2C%20%26amp%3BremainingBytes)%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%20%26nbsp%3B%20%7D%20while%20(LPUART_UART_IP_STATUS_BUSY%20%3D%3D%20lpuartStatus%20%26amp%3B%26amp%3B%200%20%26lt%3B%20T_timeout--)%3B%3C%2FDIV%3E%3CDIV%3E%7D%3C%2FDIV%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3EOr%20is%20there%20any%20sample%20code%20I%20can%20refer%20to%3F%3C%2FP%3E%3CP%3EThank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2042593%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K1xx%20LPUART%20IntCtrl_IP%20callback%20function%20Implement%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2042593%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Edo%20you%20use%20own%20board%20or%20EVB%3F%20On%20S32K118EVB%20you%20should%20use%20different%20pins%20then%20the%20one%20selected.%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2042312%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K1xx%20LPUART%20IntCtrl_IP%20callback%20function%20Implement%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2042312%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20tried%20implementing%20the%20RX%20interrupt%20on%20both%20UART0%20and%20UART1%2C%3C%2FP%3E%3CP%3Ebut%20I%20couldn't%20receive%20the%20RX_FULL%20event%20for%20either%20of%20them.%3C%2FP%3E%3CP%3EAdditionally%2C%20I%20encountered%20a%20LPUART_UART_IP_EVENT_ERROR%20on%20UART1.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Pohsuan_0-1739343799211.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Pohsuan_0-1739343799211.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F323559iDC9B825A1B000200%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Pohsuan_0-1739343799211.png%22%20alt%3D%22Pohsuan_0-1739343799211.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ECould%20you%20please%20help%20me%20review%20my%20code%20to%20check%20if%20there's%20anything%20incorrectly%20configured%3F%3C%2FP%3E%3CP%3EI%20would%20really%20appreciate%20your%20assistance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2041800%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K1xx%20LPUART%20IntCtrl_IP%20callback%20function%20Implement%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2041800%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Ethe%26nbsp%3B%3CSPAN%3ELPUART_UART_IP0_IRQHandler%20is%20assigned%20nowhere%20so%20there%20is%20no%20reason%20to%20be%20called.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E1)%20the%20Lpuart_Uart_Ip_EventType%20enum%20of%20the%20Events%20which%20can%20trigger%20UART%20callback%20is%20defined%20in%26nbsp%3Blpuart_uart_ip_types.h.%26nbsp%3B%3CBR%20%2F%3ETeh%20callback%20with%26nbsp%3BLPUART_UART_IP_EVENT_RX_FULL%26nbsp%3Bevent%20is%20called%20when%20defined%20number%20of%20bytes%20(specified%20in%20AsyncReceive%20function)%20was%20received.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E2)%20the%26nbsp%3BLPUART_UART_IP_0_IRQHandler%20is%20driver%20ISR%20routine%20assigned%20for%20module%20interrupt.%20When%20byte%20is%20received%2Fsend%20this%20handler%20is%20called%2C%20byte%20serviced%20and%20user%20callback%20is%20called%20from%20there%20if%20defined%20event%20is%20achieved.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E3)%20you%20can%20check%20in%20debugger%20if%20driver%20interrupt%20is%20get%2C%20means%26nbsp%3BLPUART_UART_IP_0_IRQHandler%20called.%20if%20yes%20then%26nbsp%3BLPUART_UART_IP_EVENT_RX_FULL%20would%20be%20called%20as%20well%20after%26nbsp%3Bdefined%20number%20of%20bytes%20is%20received.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBR%2C%20Petr%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2041585%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K1xx%20LPUART%20IntCtrl_IP%20callback%20function%20Implement%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2041585%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20PetrS%3C%2FP%3E%3CP%3EThanks%20for%20your%20reply%3C%2FP%3E%3CP%3EI'm%20testing%20the%20UART%20callback%20function%20by%20enabling%20UART%20loopback%20mode.%3C%2FP%3E%3CP%3EI%20can%20receive%20the%20UART_Callback%20event%2C%20but%20the%20LPUART_UART_IP0_IRQHandler%20function%20is%20not%20being%20executed.%3C%2FP%3E%3CP%3EI%20have%20some%20questions%20regarding%20this%20setup%3A%3C%2FP%3E%3CP%3E1.%20Where%20can%20I%20set%20the%20LPUART_UART_IP_EVENT_RX_FULL%20value%3F%3C%2FP%3E%3CP%3E2.%20If%20the%20UART%20event%20is%20triggered%2C%20what%20is%20the%20purpose%20of%20the%20LPUART_UART_IP0_IRQHandler%20function%3F%3C%2FP%3E%3CP%3E3.If%20UART%20loopback%20mode%20is%20not%20enabled%20and%20I%20use%20another%20UART%20TX%20to%20send%20data%20to%20the%20S32K118%20RX%2C%3C%2FP%3E%3CP%3EI%20am%20unable%20to%20receive%20the%20LPUART_UART_IP_EVENT_RX_FULL%20event.%3C%2FP%3E%3CP%3Ehere%20is%20my%20testing%20function%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Evoid%20sendstring(char*%20string)%0A%7B%0A%20%20%20%20Lpuart_Uart_Ip_AsyncSend(UART_LPUART_INTERNAL_CHANNEL%2C%20string%2C%20strlen(string))%3B%0A%7D%0A%0Avoid%20UART_Callback(const%20uint8%20HwInstance%2C%20const%20Lpuart_Uart_Ip_EventType%20Event%2C%20void%20*UserData)%0A%7B%0A%20%20%20%20if(HwInstance%20%3D%3D%20UART_LPUART_INTERNAL_CHANNEL)%0A%20%20%20%20%7B%0A%20%20%20%20%09switch(Event)%7B%0A%20%20%20%20%09case%20LPUART_UART_IP_EVENT_RX_FULL%3A%0A%0A%20%20%20%20%09%09sendstring(%22LPUART_UART_IP_EVENT_RX_FULL%5Cr%5Cn%22)%3B%0A%20%20%20%20%09%20%20%20%20ISR_UART%20%3D%201%3B%0A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09case%20LPUART_UART_IP_EVENT_TX_EMPTY%3A%0A%20%20%20%20%09%09sendstring(%22LPUART_UART_IP_EVENT_TX_EMPTY%5Cr%5Cn%22)%3B%0A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09case%20LPUART_UART_IP_EVENT_END_TRANSFER%3A%0A%20%20%20%20%09%09%2F%2Fsendstring(%22LPUART_UART_IP_EVENT_END_TRANSFER%5Cr%5Cn%22)%3B%0A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09case%20LPUART_UART_IP_EVENT_ERROR%3A%0A%20%20%20%20%09%09sendstring(%22LPUART_UART_IP_EVENT_ERROR%5Cr%5Cn%22)%3B%0A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09%2F%2Fcase%20LPUART_UART_IP_EVENT_IDLE_STATE%3A%0A%0A%20%20%20%20%09%09%2F%2Fbreak%3B%0A%20%20%20%20%09default%3A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09%7D%0A%20%20%20%20%7D%0A%7D%0Avoid%20LPUART_UART_IP0_IRQHandler()%0A%7B%0A%09sendstring(%22LPUART_UART_IP0_IRQHandler%5Cr%5Cn%22)%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EI%20would%20greatly%20appreciate%20any%20advice%20you%20can%20provide.%20Thank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2039922%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K1xx%20LPUART%20IntCtrl_IP%20callback%20function%20Implement%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2039922%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Eif%20you%20want%20to%20use%20driver's%20interrupt%20routine%20and%20call%20own%20callback%20from%20it%20then%20just%20configure%20respective%20handler%20in%20IntCtrl%20component%20(here%20lpuart%206%20is%20shown%2C%20use%20your%20instance)%20and%20add%20your%20callback%20function%20in%20Lpuart%20component%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222025-02-07_11-43-35.png%22%20style%3D%22width%3A%20857px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222025-02-07_11-43-35.png%22%20style%3D%22width%3A%20857px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322890i7EF5967A5631E409%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222025-02-07_11-43-35.png%22%20alt%3D%222025-02-07_11-43-35.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222025-02-07_11-43-57.png%22%20style%3D%22width%3A%20531px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222025-02-07_11-43-57.png%22%20style%3D%22width%3A%20531px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F322891i816981F0DC6C6126%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222025-02-07_11-43-57.png%22%20alt%3D%222025-02-07_11-43-57.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThen%20in%20your%20code%20you%20add%20callback%20and%20do%20your%20need%20according%20available%20events%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Evoid%20Uart_Callback(const%20uint8%20HwInstance%2C%20const%20Lpuart_Uart_Ip_EventType%20Event%2C%20void%20*UserData)%0A%7B%0A%20%20%20%20if(HwInstance%20%3D%3D%20UART_INSTANCE)%0A%20%20%20%20%7B%0A%20%20%20%20%09switch(Event)%7B%0A%20%20%20%20%09case%20LPUART_UART_IP_EVENT_RX_FULL%3A%0A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09case%20LPUART_UART_IP_EVENT_TX_EMPTY%3A%0A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09case%20LPUART_UART_IP_EVENT_END_TRANSFER%3A%0A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09case%20LPUART_UART_IP_EVENT_ERROR%3A%0A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09case%20LPUART_UART_IP_EVENT_IDLE_STATE%3A%0A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09default%3A%0A%20%20%20%20%09%09break%3B%0A%20%20%20%20%09%7D%0A%20%20%20%20%7D%0A%0A%0A%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E