Content originally posted in LPCWare by kellykan on Fri Jul 17 03:36:25 MST 2015
When using the conflict resolution register on the SCT in the LPC 1820, I get no toggle on the SCT output. The CONNFLAG shows set but I dont get a toggle of SCT output when the resolution is configured for Toggle of the SCT pin.
e.g. taken code directly from the NXP PWM cookbook, but in my case im using SCT output 8. This code works fine with blinky example where there are two events so therefore its not an issue with the pin configs or mux.
void SCT_Init(void)
{
LPC_SCT->CONFIG |= (1 << 17); // two 16 bit timers, auto limit
LPC_SCT->CTRL_L |= (119 << 5); // PRE_L[12:5] = 120-1 (SCTimer/PWM clock = 12MHz/120 = 100 kHz)
LPC_SCT->MATCHREL[0].L = (100000/10)-1; // match 0 @ 10 Hz = 100 msec
LPC_SCT->EVENT[0].STATE = 0xFFFF; // event 0 happens in all state
LPC_SCT->EVENT[0].CTRL = (1 << 12); // match 0 condition only
LPC_SCT->OUT[8].SET = (1 << 0); // event 0 will set SCTx_OUT0
LPC_SCT->OUT[8].CLR = (1 << 0); // event 0 will clear SCTx_OUT0
LPC_SCT->RES = (3 << 0); // output 0 toggles on conflict
LPC_SCT->CTRL_L &= ~(1 << 2); // start timer
}
Any ideas?