LPC5516 SCT0 No IRQ

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC5516 SCT0 No IRQ

跳至解决方案
6,452 次查看
sanders7284
Contributor III

Hello I'm using the config tools to set up the SCT and I am having troble getting the IRQ to generate, even thou the counter is running and going passed the match value.

Config Screen Shots

paulsanders_0-1606819344012.png

paulsanders_1-1606819370438.png

Code generated

* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
/* clang-format on */
const sctimer_config_t SCT0_initConfig = {
.enableCounterUnify = true,
.clockMode = kSCTIMER_System_ClockMode,
.clockSelect = kSCTIMER_Clock_On_Rise_Input_0,
.enableBidirection_l = false,
.enableBidirection_h = false,
.prescale_l = 0U,
.prescale_h = 0U,
.outInitState = 0U,
.inputsync = 0U
};
uint32_t SCT0_event[1];

static void SCT0_init(void) {
SCTIMER_Init(SCT0_PERIPHERAL, &SCT0_initConfig);
/* Initialization of state 0 */
SCTIMER_CreateAndScheduleEvent(SCT0_PERIPHERAL, kSCTIMER_MatchEventOnly, 25, kSCTIMER_Out_0, kSCTIMER_Counter_L, &SCT0_event[0]);
SCTIMER_SetupCounterLimitAction(SCT0_PERIPHERAL, kSCTIMER_Counter_L, SCT0_event[0]);
/* Enable interrupt SCT0_IRQn request in the NVIC. */
EnableIRQ(SCT0_IRQN);
}

IRQ handler set up

//SCT0_IRQ ---------------------------------------------------------------------
void SCT0_IRQHANDLER (void)
{
if ((SCT0->EVFLAG & 1) == 1) //event 0 pending //1.5uS elapsed
{
SCT0->EVFLAG &= ~1; //Clear the SCT Event 0 Interrupt
GPIO_PortToggle(GPIO, BOARD_INITPINS_LED_RED_PORT, BOARD_INITPINS_LED_RED_GPIO_PIN_MASK);
}
}
//SCT0_IRQ [END] ---------------------------------------------------------------

 

标签 (2)
标记 (1)
0 项奖励
回复
1 解答
6,412 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello paulsanders,

 

It seems the Event0 interrupt haven't enable in the generated code, please enable it by hand, then test

whether interrupt can work.

 

 

在原帖中查看解决方案

8 回复数
6,413 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello paulsanders,

 

It seems the Event0 interrupt haven't enable in the generated code, please enable it by hand, then test

whether interrupt can work.

 

 

6,405 次查看
sanders7284
Contributor III

Thank you, that fixes the problem.

Thanks for your help.

Think it could be better documented in the SCT explanation in the user manual and also would be nice if the config tools showed you the evernt options not just the SCT IRQ.

0 项奖励
回复
6,275 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello paulsanders,

Agree with you, I will take a ticket about this suggestion, thanks.

 

Regards,

Alice

6,407 次查看
sanders7284
Contributor III

Sorry seen your attachment now, I will take a look.

0 项奖励
回复
6,408 次查看
sanders7284
Contributor III

Thanks Alice,

I can only see an IRQ for the SCT as a whole NVIC #12, where are the event IRQ held?

The only other place I can see to set this up is STATEMASKn, and this is already set up correctly.

paulsanders_0-1606988300858.png

 

0 项奖励
回复
6,358 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

 

As I said before "event interrupt enable register (EVEN)"

2020-12-14_9-56-37.jpg

 

 

Regards,

Alice

0 项奖励
回复
6,435 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello paulsanders,

Could you please share your whole project, I will help to check it on my side, thanks.

 

Regards,

Alice

0 项奖励
回复
6,431 次查看
sanders7284
Contributor III

Thanks Alice, I have attached what files I can.

Regards Paul Sanders

0 项奖励
回复