<?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: Problem with SCtimer</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-SCtimer/m-p/647834#M25718</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;I found that registers SCT1 behave as read-only.&lt;/P&gt;&lt;P&gt;I added this code to the startup:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SCT0_1);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;But SCT1 registers are still treated as read-only.&lt;/P&gt;&lt;P&gt;I noticed that I2C is during initialization resets yet, so I tried it with the SCT:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Chip_SYSCTL_PeriphReset(RESET_SCT1);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Bingo!&lt;BR /&gt;Now it works properly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Oct 2016 15:18:09 GMT</pubDate>
    <dc:creator>pavelhudecek</dc:creator>
    <dc:date>2016-10-18T15:18:09Z</dc:date>
    <item>
      <title>Problem with SCtimer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-SCtimer/m-p/647833#M25717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, i using LPC11U68JBD100 on custom board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pin 52 (P2_18) is connected to the gate of the MOSFET&amp;nbsp;switching speaker.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pin initialization:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;#define AUD_port 2&lt;BR /&gt;#define AUD_pin1 18&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chip_IOCON_PinMuxSet(LPC_IOCON, AUD_port, AUD_pin1, IOCON_FUNC1);&lt;BR /&gt; Chip_GPIO_SetPinDIROutput(LPC_GPIO, AUD_port, AUD_pin1);&lt;BR /&gt; Chip_GPIO_SetPinState(LPC_GPIO, AUD_port, AUD_pin1, 0);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I copied this code from AN11538, i changed the frequency to 1 kHz, timer to SCT1 and output to 2:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;#define LPC_SCT LPC_SCT1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LPC_SCT-&amp;gt;CONFIG |= 1; // unified timer&lt;BR /&gt; LPC_SCT-&amp;gt;MATCHREL[0].U = (SystemCoreClock/1000)-1; // match 0 @ 10 Hz = 100 msec&lt;BR /&gt; LPC_SCT-&amp;gt;EVENT[0].STATE = (1 &amp;lt;&amp;lt; 0); // event 0 only happens in state 0&lt;BR /&gt; LPC_SCT-&amp;gt;EVENT[0].CTRL = (0 &amp;lt;&amp;lt; 0) | // related to match 0&lt;BR /&gt; (1 &amp;lt;&amp;lt; 12) | // COMBMODE[13:12] = match condition only&lt;BR /&gt; (1 &amp;lt;&amp;lt; 14) | // STATELD[14] = STATEV is loaded into state&lt;BR /&gt; (1 &amp;lt;&amp;lt; 15); // STATEV[15] = 1 (new state is 1)&lt;BR /&gt; LPC_SCT-&amp;gt;EVENT[1].STATE = (1 &amp;lt;&amp;lt; 1); // event 1 only happens in state 1&lt;BR /&gt; LPC_SCT-&amp;gt;EVENT[1].CTRL = (0 &amp;lt;&amp;lt; 0) | // related to match 0&lt;BR /&gt; (1 &amp;lt;&amp;lt; 12) | // COMBMODE[13:12] = match condition only&lt;BR /&gt; (1 &amp;lt;&amp;lt; 14) | // STATELD[14] = STATEV is loaded into state&lt;BR /&gt; (0 &amp;lt;&amp;lt; 15); // STATEV[15] = 0 (new state is 0)&lt;BR /&gt; LPC_SCT-&amp;gt;OUT[2].SET = (1 &amp;lt;&amp;lt; 0); // event 0 will set SCT_OUT0&lt;BR /&gt; LPC_SCT-&amp;gt;OUT[2].CLR = (1 &amp;lt;&amp;lt; 1); // event 1 will clear SCT_OUT0&lt;BR /&gt; LPC_SCT-&amp;gt;LIMIT_L = 0x0003; // events 0 and 1 are used as counter limit&lt;BR /&gt; LPC_SCT-&amp;gt;CTRL_L &amp;amp;= ~(1 &amp;lt;&amp;lt; 2); // unhalt by clearing bit 2 of CTRL register&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Afther I run this code, speaker not beeping. The pin is all time on zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I skip change of IOCON at startup, and I only periodically switching port, the speaker beeping.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 13:37:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-SCtimer/m-p/647833#M25717</guid>
      <dc:creator>pavelhudecek</dc:creator>
      <dc:date>2016-10-18T13:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SCtimer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-SCtimer/m-p/647834#M25718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;I found that registers SCT1 behave as read-only.&lt;/P&gt;&lt;P&gt;I added this code to the startup:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SCT0_1);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;But SCT1 registers are still treated as read-only.&lt;/P&gt;&lt;P&gt;I noticed that I2C is during initialization resets yet, so I tried it with the SCT:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Chip_SYSCTL_PeriphReset(RESET_SCT1);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Bingo!&lt;BR /&gt;Now it works properly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 15:18:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Problem-with-SCtimer/m-p/647834#M25718</guid>
      <dc:creator>pavelhudecek</dc:creator>
      <dc:date>2016-10-18T15:18:09Z</dc:date>
    </item>
  </channel>
</rss>

