LPIT0 Ch1 Interrupt.

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,345件の閲覧回数
antonio_rodrigu
Contributor II

Hello,

I need to configure LPIT0_CH1 in S32K144-QN57U, after some attempts I was not able to make it work, can anyone help me to review next configuration :

Thank you, Antonio.

#define LPIT0_BASE (0x40037000u)

#define LPIT0 ((LPIT_Type *)LPIT0_BASE)

void NVIC_init_IRQs (void) {
S32_NVIC->ICPR[1] = 1 << (49 % 32);
S32_NVIC->ISER[1] = 1 << (49 % 32);
S32_NVIC->IP[49] = 0xF0;
}

void LPIT0_init (void) {
PCC->PCCn[PCC_LPIT_INDEX] = PCC_PCCn_PCS(6);
PCC->PCCn[PCC_LPIT_INDEX] |= PCC_PCCn_CGC_MASK;
LPIT0->MCR = 0x00000001;
LPIT0->MIER = 0x00000010;
LPIT0->TMR[1].TVAL = 10000000;
LPIT0->TMR[1].TCTRL = 0x10000001;
}


void LPIT0_Ch1_IRQHandler (void) {
LPIT0->MSR |= LPIT_MSR_TIF1_MASK; /* Clear LPIT1 timer flag 0 */

PTD->PTOR |= 1<<LED_GREEN; /* Toggle output on port */
}

ラベル(1)
タグ(4)
1 解決策
2,065件の閲覧回数
stanish
NXP Employee
NXP Employee

Hi Antonio,

From the code snippet it seems the problem seems to be caused by wrong PIT interrupt enable register (MIER):

pastedImage_1.png

void LPIT0_init (void) {
PCC->PCCn[PCC_LPIT_INDEX] = PCC_PCCn_PCS(6); 
PCC->PCCn[PCC_LPIT_INDEX] |= PCC_PCCn_CGC_MASK; 
LPIT0->MCR = 0x00000001; 
LPIT0->MIER = 0x00000002;    // channel 1 enable (TIE1)
LPIT0->TMR[1].TVAL = 10000000; 
LPIT0->TMR[1].TCTRL = 0x10000001; 
}


Hope it helps,

Stan

元の投稿で解決策を見る

2 返答(返信)
2,066件の閲覧回数
stanish
NXP Employee
NXP Employee

Hi Antonio,

From the code snippet it seems the problem seems to be caused by wrong PIT interrupt enable register (MIER):

pastedImage_1.png

void LPIT0_init (void) {
PCC->PCCn[PCC_LPIT_INDEX] = PCC_PCCn_PCS(6); 
PCC->PCCn[PCC_LPIT_INDEX] |= PCC_PCCn_CGC_MASK; 
LPIT0->MCR = 0x00000001; 
LPIT0->MIER = 0x00000002;    // channel 1 enable (TIE1)
LPIT0->TMR[1].TVAL = 10000000; 
LPIT0->TMR[1].TCTRL = 0x10000001; 
}


Hope it helps,

Stan

2,065件の閲覧回数
antonio_rodrigu
Contributor II

Yes, It worked.

Thank you, Stanislav... cheers with vodka!

0 件の賞賛
返信