Why LPUART2 IRQHandler not working?

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

Why LPUART2 IRQHandler not working?

514 Views
rysardsuboc
Contributor II

I am using MKL82Z MCU, and kinetis sdk 2.3 libraries.

I initialized LPUART2 interface:

CLOCK_SetLpuartClock(1);
lpuart_config_t config;
LPUART_GetDefaultConfig(&config);
config.baudRate_Bps = 115200;
config.enableTx = true;
config.enableRx = true;

LPUART_Init(LPUART2, &config, CLOCK_GetFreq(kCLOCK_PllFllSelClk));
LPUART_EnableInterrupts(LPUART2, kLPUART_RxDataRegFullInterruptEnable);
EnableIRQ(LPUART2_IRQn);

My lpuart2 irq handel function:

void LPUART2_IRQHandler(void)
{
     uint32_t Status_Flag = LPUART_GetStatusFlags(LPUART2);
     for(size_t i = 0; i < 5; i++)
     {
          ToggleLed(1);
          delayMs(30);
     }
}

I Never falls into the LPUART2_IRQHandler function.

why this is happening?

0 Kudos
1 Reply

367 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Have you try to configure PTD2 and PTD3 as LPUART2 function and enable the clock gate of Port D?

BOARD_InitPins.png
If you are using TWR-KL82Z72M or FRDM-KL82Z, the PTD2 is used for other function by default. You should notice the hardware circuit.

PTD2 FRDM-KL82Z.png

PTD2 TWR-KL82Z72M.png

Best Regards,

Robin

 

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

0 Kudos