Hi,
I will have a test next week. for the following code, the SCT0 counter can count tick, but the red led can not toggle, I have not a scope on hand, I will test with a scope next week.
BR
XiangJun Rong
#define FREQ_CLOCK_MCU 18000000
void SCTimerInit(void)
{
//SW, SCTimer,GPIO1,ICON
SYSCON->SYSAHBCLKCTRL0 |= (1<<7) | (1<<8)|(1<<18)|(1<<20);
SYSCON->SCTCLKSEL=1; //USE MAIN CLOCK AS sct CLOCK
SYSCON->SCTCLKDIV=1; //enable the SCT clock
SCT0->CONFIG |= (1<<0)|(1<<17);
SCT0->MATCH[0]=(uint32_t)(FREQ_CLOCK_MCU/1);
SCT0->MATCHREL[0]=(uint32_t)(FREQ_CLOCK_MCU/1);
SCT0->EV[0].STATE=0xFFFFFFFF;
SCT0->EV[0].CTRL= 0 | (1<<12);
SCT0->OUTPUT=0xC;
SCT0->RES=0b01010101;
SCT0->EVEN=1;
SCT0->EV[1].STATE=0xFFFFFFFF;
SCT0->EV[1].CTRL = 1 | (1<<12);
SCT0->OUT[0].SET = 1<<1;
SCT0->OUT[0].CLR = 1;
SCT0->MATCH[1] = (uint32_t)(FREQ_CLOCK_MCU/(2*1));
SCT0->MATCHREL[1] = (uint32_t)(FREQ_CLOCK_MCU/(2*1));
//NVIC->ISER[0] = (1<<9);
//SWM0->PINASSIGN.PINASSIGN8=1*32+15; //BLUE LED
SWM0->PINASSIGN.PINASSIGN8=0; //P0_0 green led
SCT0->CTRL &= ~(1 << 2);
setDuty(20);
while(1){}
}