<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC Microcontrollers中的主题 Re: how to setup LPC_INMUX to feed external input to SCT?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563704#M16719</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larsen on Tue Sep 01 08:19:03 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thnaks, Its not stupid question, yes I am calling the Chip_SCT_Init() which does enable the clock.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_SYSCTL_PeriphReset(RESET_SCT);
Chip_SCT_Init(LPC_SCT);/* enable the SCT clock&amp;nbsp; and reset sct&amp;nbsp;&amp;nbsp; */
Chip_SCT_SetControl(LPC_SCT, SCT_CTRL_PRE_L(SystemCoreClock/1000000-1)); /* set prescaler, SCT clock = 1 MHz, clear counter&amp;nbsp;&amp;nbsp; */

sct_fsm_init();
Chip_SCT_SetControl(LPC_SCT, SCT_CTRL_PRE_L(SystemCoreClock/1000000-1)); /* set prescaler, SCT clock = 1 MHz, clear counter&amp;nbsp;&amp;nbsp; */
app_setup_pin();
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is slightly confucing, In this distribution for the cookbook there are two versions of similar function: &lt;/SPAN&gt;&lt;BR /&gt;&lt;I&gt;...\SCT cookbook AN11538\AN11538_v4.0\code examples\LPC82x\LPCOpen\applications\lpc82x\examples\SCTimer_PWM\periph_SCT_pwm_2ch&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and &lt;/SPAN&gt;&lt;BR /&gt;&lt;I&gt;...\SCT cookbook AN11538\AN11538_v4.0\code examples\LPC82x\LPCOpen\applications\lpc82x\lpcxpresso_projects\nxp_lpcxpresso_824\nxp_lpcxpresso_824_SCT_PWM_examples\periph_SCT_2ch&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried the periph_SCT_pwm_2ch and it works, so now I have to figure out what the difference are. Problem is I try to use redState and the example uses manual calls.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am lacking - in the cookbook examples which uses the red state. The examples are all of the manual type. I think it is important that the tools are backed up by good examples - i dont find any!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ran In the example periph_SCT_4ch/main.c, the pwmAborted is never called when run on lpcxpresso board v2. This smells like the problem I have - input never read. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have comments to the weird messages I point out above?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will keep searching - but this is really frustrating&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:02:17 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:02:17Z</dc:date>
    <item>
      <title>how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563702#M16717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larsen on Sat Aug 29 01:21:04 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC824, LPCXpresso 7.9.0, LPC Xpresso V2/MBED board.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the debug-&amp;gt;peripherals-&amp;gt;SCT-&amp;gt;INPUT I can observe the state of the input(s) - they all remain 0 all time. Why?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is what I think must be the essential code part:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;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,&amp;nbsp; 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
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;A note about LPC_INMUX: In the debugger-&amp;gt;peripherals-&amp;gt;INPUTMUX[LPS824]. After running this code and halting in the __WFI() the debugger-&amp;gt;peripherals-&amp;gt;INPUTMUX[LPS824]-&amp;gt;SCT0-INMUX0-&amp;gt;INP-N has changed from &lt;/SPAN&gt;&lt;STRONG&gt;UNKNOWN(0xF)&lt;/STRONG&gt;&lt;SPAN&gt; to &lt;/SPAN&gt;&lt;STRONG&gt;SCT_IN0_CHANGE_THE&lt;/STRONG&gt;&lt;SPAN&gt; &amp;lt;&amp;lt;- Now that's a weird text, and it continues:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hovering over the name &lt;/SPAN&gt;&lt;STRONG&gt;SCT_IN0_CHANGE_THE&lt;/STRONG&gt;&lt;SPAN&gt; gives a text. &lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;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"&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What does that try to explain me?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What could be a likely reason I cannot see changes in debug-&amp;gt;peripherals-&amp;gt;SCT-&amp;gt;INPUT field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help - this problem has bugged me for days now!&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563702#M16717</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563703#M16718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcmunich on Tue Sep 01 06:57:16 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Larsen,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe a stupid question, did you enable the clock to the SCT?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please refer to AN11538: SCTimer/PWM Cookbook on nxp website, a collection of some good examples with SCT.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.nxp.com%2Fdocuments%2Fapplication_note%2FAN11538.zip" rel="nofollow" target="_blank"&gt;http://www.nxp.com/documents/application_note/AN11538.zip&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And it has couple of examples (2-ch PWM and 4-ch PWM) using the SW1 (PIO0_4) connected to SCT_IN0.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563703#M16718</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563704#M16719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larsen on Tue Sep 01 08:19:03 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thnaks, Its not stupid question, yes I am calling the Chip_SCT_Init() which does enable the clock.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_SYSCTL_PeriphReset(RESET_SCT);
Chip_SCT_Init(LPC_SCT);/* enable the SCT clock&amp;nbsp; and reset sct&amp;nbsp;&amp;nbsp; */
Chip_SCT_SetControl(LPC_SCT, SCT_CTRL_PRE_L(SystemCoreClock/1000000-1)); /* set prescaler, SCT clock = 1 MHz, clear counter&amp;nbsp;&amp;nbsp; */

sct_fsm_init();
Chip_SCT_SetControl(LPC_SCT, SCT_CTRL_PRE_L(SystemCoreClock/1000000-1)); /* set prescaler, SCT clock = 1 MHz, clear counter&amp;nbsp;&amp;nbsp; */
app_setup_pin();
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is slightly confucing, In this distribution for the cookbook there are two versions of similar function: &lt;/SPAN&gt;&lt;BR /&gt;&lt;I&gt;...\SCT cookbook AN11538\AN11538_v4.0\code examples\LPC82x\LPCOpen\applications\lpc82x\examples\SCTimer_PWM\periph_SCT_pwm_2ch&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and &lt;/SPAN&gt;&lt;BR /&gt;&lt;I&gt;...\SCT cookbook AN11538\AN11538_v4.0\code examples\LPC82x\LPCOpen\applications\lpc82x\lpcxpresso_projects\nxp_lpcxpresso_824\nxp_lpcxpresso_824_SCT_PWM_examples\periph_SCT_2ch&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried the periph_SCT_pwm_2ch and it works, so now I have to figure out what the difference are. Problem is I try to use redState and the example uses manual calls.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am lacking - in the cookbook examples which uses the red state. The examples are all of the manual type. I think it is important that the tools are backed up by good examples - i dont find any!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ran In the example periph_SCT_4ch/main.c, the pwmAborted is never called when run on lpcxpresso board v2. This smells like the problem I have - input never read. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have comments to the weird messages I point out above?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will keep searching - but this is really frustrating&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563704#M16719</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563705#M16720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcmunich on Wed Sep 02 03:56:52 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I can understand the confusion with slightly different naming, but they are basically same examples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can easily import only periph_SCT_2ch or all SCT projects into LPCXpresso (IDE) workspace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...\code examples\LPC82x\LPCOpen\applications\lpc82x\lpcxpresso_projects\nxp_lpcxpresso_824&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And yes, you need to figure out as to why your code doesn't work. But you have something to compare with.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW, this periph_SCT_2ch example and some others as well does use the code generated by red state tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tend to agree with your comment on the weird text in peripheral view, and will inform the concerned team about it. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563705#M16720</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563706#M16721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Wed Sep 02 06:07:00 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Larsen,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like you might not be clearing the HALT flag for the SCT. The HALT bits&amp;nbsp; in the control register are set when you come out of reset by default. Typically you might want to set them before changing the SCT configuration (ie before calling sct_fsm_init() ) and then clear them to start the SCT running. If you are using the SCT as two 16bit timers you need to set / clear both the *_H and *_L setting in the code below. If it is configured as a unified timer you can just use the *_L settings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
Chip_SCT_SetControl(LPC_SCT,
&amp;nbsp;&amp;nbsp; SCT_CTRL_CLRCTR_L | SCT_CTRL_HALT_L&amp;nbsp;&amp;nbsp;&amp;nbsp; // H Counter: Clear and halt
| SCT_CTRL_HALT_H | SCT_CTRL_CLRCTR_H // L Counter: Clear and halt
| SCT_CTRL_PRE_H(SystemCoreClock/1000000-1)&amp;nbsp;&amp;nbsp; // Set the pre-scaler to 1Mhz
| SCT_CTRL_PRE_L(SystemCoreClock/1000000-1)) ; //&amp;nbsp; for both the L and H counters

sct_fsm_init(); // Apply SCT configuration

Chip_SCT_ClearControl(LPC_SCT,&amp;nbsp; SCT_CTRL_HALT_L ); // Clear L Halt bit to start counter.
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is an older example which ships with LPCXpresso that demonstrates the SCT using RedState on the LPC1800 series called LPC1850A_HitexA4_SCT_Blinky. The same configuration applies to the LPC820 series. It is in the archive:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;&amp;lt;LPCXPRESSO INSTALL DIR&amp;gt;lpcxpresso_7.9.0_455/lpcxpresso/Examples/Legacy/NXP/LPC1000/LPC18xx/LPC1850A_Hitex.zip&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can import it by just going to the &lt;/SPAN&gt;&lt;STRONG&gt;Quickstart Panel &lt;/STRONG&gt;&lt;SPAN&gt;and choosing &lt;/SPAN&gt;&lt;STRONG&gt;Import Project(s)&lt;/STRONG&gt;&lt;SPAN&gt;, then select &lt;/SPAN&gt;&lt;STRONG&gt;Browse&lt;/STRONG&gt;&lt;SPAN&gt; in the Project Archive section and find the zip file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ciao,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso-Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563706#M16721</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563707#M16722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larsen on Wed Sep 02 15:11:02 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestions. It was not the halt bit which was not properly managed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It works after count less permutations, but I need someone to explain what is this code doing which I have got to work. Let me explain.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The red-state machine is very simple: One state U_ENTRY with two transitions back to U_ENTRY.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Transition 1: Input pin 0, Action: Set output pin 0,1,2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Transition 2: !Input pin 0, Action: Clr output pin 0,1,2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;See attached picture. I.e. the &lt;/SPAN&gt;&lt;STRONG&gt; input pin 0&lt;/STRONG&gt;&lt;SPAN&gt; is just copied to the 3 output pins, So pushing/releasing SW1 will turn on/resp off all leds - the simplest useful SM I could come up with in order to simplfy debugging.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works if I have the following code before the call sct_fsm_init();&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;void app_setup_pin(void)
{
/* Enable SWM clock before altering SWM */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 4, false);//Push botton SW1. &amp;lt;== should use this or not?
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 12, true);//led //12=Red, 16=Green, 27=Blue
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 16, true);//led //12=Red, 16=Green, 27=Blue
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 27, true);//led //12=Red, 16=Green, 27=Blue

/* Connect SCT input 0 to SCT_IN0 */
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC11);//PIO_04 disable
Chip_SWM_MovablePinAssign(SWM_SCT_IN0_I, 4);//=SW1, Note its&lt;STRONG&gt; IN0&lt;/STRONG&gt;

/* Connect SCT output 0,1,2 to LED pin PIO_12,16,27 respectively */
Chip_SWM_MovablePinAssign(SWM_SCT_OUT0_O, 12);//12=Red, 16=Green, 27=Blue
Chip_SWM_MovablePinAssign(SWM_SCT_OUT1_O, 16);//12=Red, 16=Green, 27=Blue
Chip_SWM_MovablePinAssign(SWM_SCT_OUT2_O, 27);//12=Red, 16=Green, 27=Blue
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Connect the INMUX
Chip_INMUX_SetSCTInMux(LPC_INMUX, SCT_INMUX_0, &lt;STRONG&gt; SCT_INP_IN1&lt;/STRONG&gt; );// all other, SCT_INP_IN0, 2, 3 do not work!!!
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Example is using Input pin 0, INMUX_0, so why does the following not work: */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Chip_INMUX_SetSCTInMux(LPC_INMUX, SCT_INMUX_0, &lt;STRONG&gt; SCT_INP_IN0&lt;/STRONG&gt; ); //BAD
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;SPAN&gt;All those mux levels are difficult to track, but why should I use &lt;/SPAN&gt;&lt;STRONG&gt; SCT_INP_IN1&lt;/STRONG&gt;&lt;SPAN&gt; in the code above when I use SCT_IN0?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I browse to the definition of SCT_INP_IN0 I read this typedef with a suspicious comment:&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;typedef enum {
SCT_INP_IN0,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; SCT0_IN0 selected by Pin Matrix */&lt;STRONG&gt; /* FIXME: UM hints about changes */&lt;/STRONG&gt;
SCT_INP_IN1,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; SCT0_IN1 selected by Pin Matrix */
SCT_INP_IN2,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; SCT0_IN2 selected by Pin Matrix */
SCT_INP_IN3,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; SCT0_IN3 selected by Pin Matrix */
SCT_INP_ADC_THCMP_IRQ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; ADC Threshold compare IRQ */
SCT_INP_ACMP_O,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Analog comparator output */
SCT_INP_ARM_TXEV,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; ARM TX Event */
SCT_INP_DEBUG_HALTED,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Debug halted event */
} SCT_INP_T;
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;What does this mean?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks so far for all the suggestions, but I need the final mental "cleanup" as this result does not make sense to me right now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563707#M16722</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563708#M16723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcmunich on Thu Sep 03 03:20:24 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Larsen,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I just tested this and it works for me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As you can see, I am using SCT_INP_IN0 only.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please don't try to read too much into this "FIXME" comment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;int main(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/* Generic Initialization */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SystemCoreClockUpdate();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Board_Init();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_Clock_SetSysClockDiv(2);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_SWM_Init();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_SCT_Init(LPC_SCT);/* enable the SCT clock&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_INMUX_SetSCTInMux(LPC_INMUX, SCT_INMUX_0, SCT_INP_IN0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_SWM_DisableFixedPin(SWM_FIXED_ADC11);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //disable Pinmux for P0_4 (ADC11)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_SWM_MovablePinAssign(SWM_SCT_IN0_I,&amp;nbsp;&amp;nbsp; 4);/* CTIN_0-&amp;gt;PIO0_4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_SWM_MovablePinAssign(SWM_SCT_OUT0_O, 16);/* CTOUT_0-&amp;gt;PIO0_16 (green)&amp;nbsp;&amp;nbsp; */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_SWM_MovablePinAssign(SWM_SCT_OUT1_O,&amp;nbsp; 12);/* CTOUT_1-&amp;gt;PIO0_12 (red)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sct_fsm_init();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Initialize the SCT using the code generated by Red State */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __WFI();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563708#M16723</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563709#M16724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larsen on Thu Sep 03 13:47:27 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, nxp69442&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok I give up. There is too much black magic here. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) How can the code you show work because there is missing the dreaded halt bit also recommended by others here. So after the &lt;/SPAN&gt;&lt;I&gt;sct_fsm_init()&lt;/I&gt;&lt;SPAN&gt;; there need to be&amp;nbsp; a call to&lt;/SPAN&gt;&lt;BR /&gt;&lt;I&gt;Chip_SCT_ClearControl(LPC_SCT, SCT_CTRL_HALT_L);&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) I have added this halt line in order to get it to work somehow. There is no mistake - when using&lt;/SPAN&gt;&lt;BR /&gt;&lt;I&gt;Chip_INMUX_SetSCTInMux(LPC_INMUX, SCT_INMUX_0, &lt;STRONG&gt;SCT_INP_IN0&lt;/STRONG&gt;);&lt;/I&gt;&lt;BR /&gt;&lt;SPAN&gt;the led is constant on. And when using&lt;/SPAN&gt;&lt;BR /&gt;&lt;I&gt;Chip_INMUX_SetSCTInMux(LPC_INMUX, SCT_INMUX_0, &lt;STRONG&gt;SCT_INP_IN1&lt;/STRONG&gt;);&lt;/I&gt;&lt;BR /&gt;&lt;SPAN&gt;it works - the led switch on when button is pushed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I dont know - can it be we are using different versions I use: LPCXpresso v7.9.0 [Build 455] [2015-07-23] &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can it be the chip's revision are different? This one is marked Q824 z 58 01 14 271A. the board is marked lpc82x Xpresso v2/mbed,&amp;nbsp; W0-0572 E225430kb-01x&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok I cannot exclude that some of the solder jumpers are in another state than the default - but I cannot see how any external wire could alter the SCT_INP_INx - can you?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;By the way, if the SM is set to use input pin1 instead of input pin0, then the code need to use SCT_INP_IN2, i.e. one higher again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As I wrote - I have given up in understanding this. So I have attached the example I have based on your code. - plus the red.state machine as decribed In the hope someone can reproduce a bit of what I see.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563709#M16724</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563710#M16725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by starblue on Fri Sep 04 01:19:22 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Your definition of SWM_SCT_IN0_I is wrong, the = 0x70 should be on SWM_SCT_IN1_I (see the PINASSIGNx registers in the user manual).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you change that?&amp;nbsp; I checked in LPCOpen 2.19, where it is correct.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563710#M16725</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to setup LPC_INMUX to feed external input to SCT?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563711#M16726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larsen on Fri Sep 04 01:39:07 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;You are right, starblue. There is a mistake in the library - yes it must be me who has changed it by accident - no one else can it be.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What a relief to be able to get on with the real work. Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:02:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/how-to-setup-LPC-INMUX-to-feed-external-input-to-SCT/m-p/563711#M16726</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:02:25Z</dc:date>
    </item>
  </channel>
</rss>

