I'm trying to get this example running, but its not producing the 36 kHz pulses. The samples are different for Keil and other IDE. The Keil example seems to be better, although for LPC812.
I cannot get the event0 triggered with the given config, it should trigger with a dummy input pin, the triggersignal is present. Other events happen, I have checked this with an IRQ Handler for the different events.
Has anybody got this working?
void SCT_Init(void)
{
Chip_SCT_Init(LPC_SCT); // enable the SCT clock
// Chip_SCT_Config(LPC_SCT, SCT_CONFIG_16BIT_COUNTER); // split timer
LPC_SCT->CONFIG = (LPC_SCT->CONFIG & ~0x00060001) | SCT_CONFIG_16BIT_COUNTER;
LPC_SCT->REGMODE_L = 0x0000; /* L: 2x MATCH, 0x CAPTURE, 3 unused */
LPC_SCT->REGMODE_H = 0x0000; /* L: 2x MATCH, 0x CAPTURE, 3 unused */
Chip_SCT_SetControl(LPC_SCT, SCT_CTRL_PRE_L(SCT_PRESCALER - 1));
Chip_SCT_Output(LPC_SCT, 0 ); // SCT_OUT0 (IR output) is low
Chip_SCT_SetMatchCountL(LPC_SCT, SCT_MATCH_0, SCT_MATCH_DUTY_CYCLE); // 75% of 36 KHz
Chip_SCT_SetMatchReloadL(LPC_SCT, SCT_MATCH_0, SCT_MATCH_DUTY_CYCLE);
Chip_SCT_SetMatchCountL(LPC_SCT, SCT_MATCH_1, SCT_MATCH_PULSE_LENGTH); // 36 KHz
Chip_SCT_SetMatchReloadL(LPC_SCT, SCT_MATCH_1, SCT_MATCH_PULSE_LENGTH);
Chip_SCT_EventState(LPC_SCT, SCT_EVENT_0, ENABLE_ALL_STATES); // event 0 happens in all states
Chip_SCT_EventControl(LPC_SCT, SCT_EVENT_0, (CHIP_SCT_EVENTCTRL_T) ( SCT_EVECTRL_MATCH0 | // MATCHSEL [3:0] = related to match 0
SCT_HEVENT_L | // HEVENT [4] = use L state & match
SCT_OUTSEL_L | // OUTSEL [5] = select input from IOSEL
SCT_IOSEL_RISEIN0 | // IOSEL [9:6] = select input 0
SCT_IOCOND_HIGH | // IOCOND [11:10] = high level
SCT_COMBMODE_OR | // COMBMODE [13:12] = match AND IO condition
SCT_STATELD_0 | // STATELD [14] = STATEV is added to state
SCT_STATEEV_0 | // STATEV [19:15] = no state change
SCT_MATCHMEM | // MATCHMEM [20] = "equal" to match
SCT_DIRECTION )); // DIRECTION[22:21] = direction independent
This is part of the configuration. I have modified SCT_COMBMODE from AND to OR, then I get 36 kHz pulses, but now continous.
When I change to COMBMODE_IO, then it is not triggered. But the IO should be assigned with
Chip_SWM_MovablePinAssign(SWM_SCT_IN0_I, 15); // CTIN_0 -> PIO0_15 (PWM input) dummy
The demo code is definitely not working and contains poor bugs:
with fixing this, its working, but there are more flaws:
sorry, very poor quality and no updates since many years, no public repo for issue reporting, unusable.
Hello ,
So do meaning the demo code without any change can not work on your side?
And what's the problem now?
BR
Alice