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
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] ---------------------------------------------------------------
Solved! Go to Solution.
It seems the Event0 interrupt haven't enable in the generated code, please enable it by hand, then test
whether interrupt can work.
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.
Hello paulsanders,
Agree with you, I will take a ticket about this suggestion, thanks.
Regards,
Alice
Sorry seen your attachment now, I will take a look.
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.
Hello,
As I said before "event interrupt enable register (EVEN)"
Regards,
Alice
Hello paulsanders,
Could you please share your whole project, I will help to check it on my side, thanks.
Regards,
Alice