<?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中的主题 LPC4353 Timer Clock Source (PCLK)</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4353-Timer-Clock-Source-PCLK/m-p/1500177#M49753</link>
    <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to configure LPC_TIMER1 on the LPC4353, I can't seem to figure out where the PCLK comes from.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the initialisation code used for the timer:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;void timer__init() {
	Chip_TIMER_Init(LPC_TIMER1);
	uint32_t clocks_per_second = Chip_Clock_GetRate(CLK_MX_TIMER1);
	uint32_t clocks_per_10ms = clocks_per_second / 100;
	Chip_TIMER_Reset(LPC_TIMER1);
	Chip_TIMER_PrescaleSet(LPC_TIMER1, 0);
	Chip_TIMER_SetMatch(LPC_TIMER1, 1, clocks_per_10ms);
	Chip_TIMER_MatchEnableInt(LPC_TIMER1, 1);
	Chip_TIMER_ResetOnMatchEnable(LPC_TIMER1, 1);
	Chip_TIMER_StopOnMatchEnable(LPC_TIMER1, 1);
	NVIC_SetPriority(TIMER1_IRQn, 2);
	NVIC_ClearPendingIRQ(TIMER1_IRQn);
	NVIC_EnableIRQ(TIMER1_IRQn);
	Chip_TIMER_Enable(LPC_TIMER1);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Chip_Clock_GetRate should return the frequency of PCLK used by the timer to increment the count, however using this to setup the match value does not lead to the expected delay.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Timing the actual delay and comparing this to the expected delay I found the timer seems to be getting incremented 17 times slower than it should be.&lt;/P&gt;&lt;P&gt;The variable clocks_per_second indicates the PCLK should be running at a frequency of 204 MHz, but the timer actual gets incremented as if a 12 MHz signal is used. (204/17 = 12).&amp;nbsp;&lt;/P&gt;&lt;P&gt;The user manual isn't really clear about how PCLK is derived either. I assume PCLK and CLK_MX_TIMER1 are essentially the same, and looking at&amp;nbsp;Table 155. CCU1 branch clocks would suggest that CLK_MX_TIMER1 is a branch clock generated by clock control unit 1 from BASE_M4_CLK. The CCU configuration registers only allow enabled/disabling the clock, AHB, and wake-up. No scaling options.&lt;/P&gt;&lt;P&gt;CLK_BASE_MX is setup to come from CLKIN_MAINPLL which is setup to run at a frequency of 204 MHz.&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2022 10:13:58 GMT</pubDate>
    <dc:creator>M_H</dc:creator>
    <dc:date>2022-08-03T10:13:58Z</dc:date>
    <item>
      <title>LPC4353 Timer Clock Source (PCLK)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4353-Timer-Clock-Source-PCLK/m-p/1500177#M49753</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to configure LPC_TIMER1 on the LPC4353, I can't seem to figure out where the PCLK comes from.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the initialisation code used for the timer:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;void timer__init() {
	Chip_TIMER_Init(LPC_TIMER1);
	uint32_t clocks_per_second = Chip_Clock_GetRate(CLK_MX_TIMER1);
	uint32_t clocks_per_10ms = clocks_per_second / 100;
	Chip_TIMER_Reset(LPC_TIMER1);
	Chip_TIMER_PrescaleSet(LPC_TIMER1, 0);
	Chip_TIMER_SetMatch(LPC_TIMER1, 1, clocks_per_10ms);
	Chip_TIMER_MatchEnableInt(LPC_TIMER1, 1);
	Chip_TIMER_ResetOnMatchEnable(LPC_TIMER1, 1);
	Chip_TIMER_StopOnMatchEnable(LPC_TIMER1, 1);
	NVIC_SetPriority(TIMER1_IRQn, 2);
	NVIC_ClearPendingIRQ(TIMER1_IRQn);
	NVIC_EnableIRQ(TIMER1_IRQn);
	Chip_TIMER_Enable(LPC_TIMER1);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Chip_Clock_GetRate should return the frequency of PCLK used by the timer to increment the count, however using this to setup the match value does not lead to the expected delay.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Timing the actual delay and comparing this to the expected delay I found the timer seems to be getting incremented 17 times slower than it should be.&lt;/P&gt;&lt;P&gt;The variable clocks_per_second indicates the PCLK should be running at a frequency of 204 MHz, but the timer actual gets incremented as if a 12 MHz signal is used. (204/17 = 12).&amp;nbsp;&lt;/P&gt;&lt;P&gt;The user manual isn't really clear about how PCLK is derived either. I assume PCLK and CLK_MX_TIMER1 are essentially the same, and looking at&amp;nbsp;Table 155. CCU1 branch clocks would suggest that CLK_MX_TIMER1 is a branch clock generated by clock control unit 1 from BASE_M4_CLK. The CCU configuration registers only allow enabled/disabling the clock, AHB, and wake-up. No scaling options.&lt;/P&gt;&lt;P&gt;CLK_BASE_MX is setup to come from CLKIN_MAINPLL which is setup to run at a frequency of 204 MHz.&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 10:13:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4353-Timer-Clock-Source-PCLK/m-p/1500177#M49753</guid>
      <dc:creator>M_H</dc:creator>
      <dc:date>2022-08-03T10:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4353 Timer Clock Source (PCLK)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4353-Timer-Clock-Source-PCLK/m-p/1500948#M49767</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;How do you know the below?&lt;/P&gt;
&lt;P&gt;"Timing the actual delay and comparing this to the expected delay I found the timer seems to be getting &lt;FONT color="#FF0000"&gt;incremented 17 times slower than it should b&lt;/FONT&gt;e.&lt;/P&gt;
&lt;P&gt;The variable clocks_per_second indicates the PCLK should be running at a frequency of 204 MHz, &lt;FONT color="#FF0000"&gt;but the timer actual gets incremented as if a 12 MHz signal is used&lt;/FONT&gt;. (204/17 = 12).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 08:48:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4353-Timer-Clock-Source-PCLK/m-p/1500948#M49767</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2022-08-04T08:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4353 Timer Clock Source (PCLK)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4353-Timer-Clock-Source-PCLK/m-p/1504687#M49818</link>
      <description>&lt;P&gt;Hi Alice,&amp;nbsp;&lt;/P&gt;&lt;P&gt;After setting a GPO to be toggled directly in the timer interrupt, I found the timer was actually behaving correctly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please could you remove this post?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 07:42:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4353-Timer-Clock-Source-PCLK/m-p/1504687#M49818</guid>
      <dc:creator>M_H</dc:creator>
      <dc:date>2022-08-11T07:42:55Z</dc:date>
    </item>
  </channel>
</rss>

