lpcware

how to setup LPC_INMUX to feed external input to SCT?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by larsen on Sat Aug 29 01:21:04 MST 2015
LPC824, LPCXpresso 7.9.0, LPC Xpresso V2/MBED board.

The SCT state machine (SM) I am making, has a pin-input (SW1 button PIO0_04) and an output to the LED (green act low PIO0_16).
The SM should simply monitor SW1 and generate a light flash of programmable duration for each falling edge on SW1 - a one-shot in essence.
It does not work - the SCT does not see the SW1, judging from the debugger. The SW1 is working, I can detect by GPIO check.

In the debug->peripherals->SCT->INPUT I can observe the state of the input(s) - they all remain 0 all time. Why?

Here is what I think must be the essential code part:
void app_setup_pin(void)
{
/* Enable SWM clock before altering SWM */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 4, false);//Push botton SW1 = PIO0_04
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 16, true);//green led act low = PIO0_16
/* Connect SCT input 0 to SW1 pin PIO0_04 */
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC11);//PIO_04 disable
Chip_SWM_MovablePinAssign(SWM_SCT_IN0_I, 4);//=SW1=Wake texted
Chip_INMUX_SetSCTInMux(LPC_INMUX, SCT_INMUX_0,  SCT_INP_IN0 );//??
/* Connect SCT output 0 to LED pin PIO_16 */
Chip_SWM_MovablePinAssign(SWM_SCT_OUT0_O, 16);//12=Red, 16=Green, 27=Blue
}

A note about LPC_INMUX: In the debugger->peripherals->INPUTMUX[LPS824]. After running this code and halting in the __WFI() the debugger->peripherals->INPUTMUX[LPS824]->SCT0-INMUX0->INP-N has changed from UNKNOWN(0xF) to SCT_IN0_CHANGE_THE <<- Now that's a weird text, and it continues:

Hovering over the name SCT_IN0_CHANGE_THE gives a text.
Quote:
SCT_IN0 change the name since this is not the function sct_in0 but the first selection for sct input in the mux. in fact it could be functionally sct_in3(input 3 of the sct). Assign to pin using the switch matix"



What does that try to explain me?
What could be a likely reason I cannot see changes in debug->peripherals->SCT->INPUT field.

Thanks for any help - this problem has bugged me for days now!

Outcomes