Hi guys
I post my code about pit timer on KE16Z. It work fine and properly but only for just one second about.
Later I can't reach the interrupt handle again.
Any suggestion for me ?
Thanks in advance
Attilio
void PIT_Init(void)
{
uint32_t reg = 0;
PCC->CLKCFG[PCC_LPIT0_INDEX] |= PCC_CLKCFG_CGC_MASK;
LPIT0->MCR |= LPIT_MCR_SW_RST_MASK;
LPIT0->MCR &= ~LPIT_MCR_SW_RST_MASK;
LPIT0->MCR = LPIT_MCR_DBG_EN(0) |
LPIT_MCR_DOZE_EN(0) |
LPIT_MCR_M_CEN_MASK;
LPIT0->MIER |= LPIT_MIER_TIE0_MASK;
reg = LPIT_TCTRL_MODE(0) |
LPIT_TCTRL_TRG_SRC(1) |
LPIT_TCTRL_TRG_SEL(0) |
LPIT_TCTRL_TROT(1) |
LPIT_TCTRL_T_EN_MASK;
LPIT0->CHANNEL[0].TCTRL = reg;
LPIT0->SETTEN |= LPIT_SETTEN_SET_T_EN_0_MASK;
LPIT0->CHANNEL[0].TVAL = 24000;
}
void LPIT0_Interrupt(void)
{
static bool b;
LPIT0->MSR |= LPIT_MSR_TIF0_MASK;
b = (b == false) ? true : false;
(b == true) ? Set_TestPin() : Res_TestPin();
}
已解决! 转到解答。
Hi,
I checked your code , you didn't enable an interrupt.
Add this "NVIC_EnableIRQ(LPIT0_IRQ);" to the PIT_Init() function.
Have a try .
Jianyu:
Have a great day,
TIC
-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------
Hi,
I checked your code , you didn't enable an interrupt.
Add this "NVIC_EnableIRQ(LPIT0_IRQ);" to the PIT_Init() function.
Have a try .
Jianyu:
Have a great day,
TIC
-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------