<?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: LPC824 System Oscillator 24MHz, clock setup issues</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-System-Oscillator-24MHz-clock-setup-issues/m-p/1506768#M49861</link>
    <description>&lt;P&gt;This code now works, issue put down to GPIO pinmode, and active pull up or pull downs?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void SetForExtrnlXtal (void)&lt;BR /&gt;{&lt;BR /&gt;uint32_t reg;&lt;BR /&gt;//sys osc bypass options&lt;BR /&gt;#define SYSOSC_BYPASS_DISABLE 0&lt;BR /&gt;#define SYSOSC_BYPASS_ENABLE 1&lt;BR /&gt;#define LO_FREQ_XTAL 0 // set when xtal in range of 1 - 20MHz&lt;BR /&gt;#define HI_FREQ_XTAL 1 // set when xtal in range of 15 - 25MHz&lt;BR /&gt;&lt;BR /&gt;//CRTSTAL PIN - pins 8 and 9 set for external crystal&lt;BR /&gt;Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM); // Enable the clock to the Switch Matrix to save power&lt;BR /&gt;Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON); // Enable clk for IO config&lt;BR /&gt;Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, PORT0, 8, GPIO_INPUT); // Set port p0.8 to input for XTAL IN&lt;BR /&gt;Chip_IOCON_PinSetMode(LPC_IOCON, IOCON_PIO8, PIN_MODE_INACTIVE);&lt;BR /&gt;Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, PORT0, 9, GPIO_INPUT); // Set port p0.9 to input for XTAL OUT&lt;BR /&gt;Chip_IOCON_PinSetMode(LPC_IOCON, IOCON_PIO9, PIN_MODE_INACTIVE);&lt;BR /&gt;Chip_SWM_EnableFixedPin(SWM_FIXED_XTALIN);&lt;BR /&gt;Chip_SWM_EnableFixedPin(SWM_FIXED_XTALOUT);&lt;BR /&gt;Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM); // Disable the clock to the Switch Matrix to save power&lt;BR /&gt;Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_IOCON); // done with the general port pins&lt;BR /&gt;// Going to use internal OScillator with external crystal, set frequency range as appropriate&lt;BR /&gt;Chip_Clock_SetPLLBypass(SYSOSC_BYPASS_DISABLE , HI_FREQ_XTAL); // (bool bypass, bool highfr)&lt;BR /&gt;&lt;BR /&gt;//power up sys osc&lt;BR /&gt;Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_SYSOSC_PD); // power up oscillator&lt;BR /&gt;//delay for power up&lt;BR /&gt;for (reg=0; reg&amp;lt;200; reg++) // give some time to stabilise&lt;BR /&gt;asm("nop");&lt;BR /&gt;&lt;BR /&gt;// Set PLL Source to external crystal&lt;BR /&gt;Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_SYSOSC);&lt;BR /&gt;for (reg=0; reg&amp;lt;200; reg++) // give some time to stabilise&lt;BR /&gt;asm("nop");&lt;BR /&gt;&lt;BR /&gt;// Set main clock&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_PLLIN); // ???? (CHIP_SYSCTL_CLKOUTSRC_T src, uint32_t div)&lt;BR /&gt;while (!(LPC_SYSCTL-&amp;gt;MAINCLKUEN&amp;amp;0x01));&lt;BR /&gt;//set system clock divider&lt;BR /&gt;LPC_SYSCTL-&amp;gt;SYSAHBCLKDIV = 1;&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2022 10:49:26 GMT</pubDate>
    <dc:creator>sanders7284</dc:creator>
    <dc:date>2022-08-16T10:49:26Z</dc:date>
    <item>
      <title>LPC824 System Oscillator 24MHz, clock setup issues</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-System-Oscillator-24MHz-clock-setup-issues/m-p/1502575#M49797</link>
      <description>&lt;P&gt;Hello, having trouble setting up to run off an external oscillator 24MHz, used&amp;nbsp;MCUXpresso Config Tools v11 to produce some code but I can't use it directly as the project was generated with V1 SDKs so been trying to map it across with little success. The datasheet and user manual are unclear on if the PPL needs to be setup if you are just pointing the main clock to the input?&amp;nbsp;&lt;/P&gt;&lt;P&gt;MCUXpresso Config Tools v11 suggested code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#00FF00"&gt;void BOARD_BootClockRUN(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;/*!&amp;lt; Set up the clock sources */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;/*!&amp;lt; Set up IRC */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;POWER_DisablePD(kPDRUNCFG_PD_IRC_OUT); /*!&amp;lt; Ensure IRC OUT is on */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;POWER_DisablePD(kPDRUNCFG_PD_IRC); /*!&amp;lt; Ensure IRC is on */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;POWER_DisablePD(kPDRUNCFG_PD_SYSOSC); /*!&amp;lt; Ensure SYSOSC is on */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;CLOCK_InitSysOsc(24000000U); /*!&amp;lt; Set main osc freq */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;CLOCK_Select(kSYSPLL_From_SysOsc); /*!&amp;lt; set sysosc to pll select */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;clock_sys_pll_t config;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;config.src=kCLOCK_SysPllSrcSysosc; /*!&amp;lt; set pll src */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;config.targetFreq = 24000000U; /*!&amp;lt; set pll target freq */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;CLOCK_InitSystemPll(&amp;amp;config); /*!&amp;lt; set parameters */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;CLOCK_SetMainClkSrc(kCLOCK_MainClkSrcSysPllin); /*!&amp;lt; select pllin for main clock */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;CLOCK_Select(kCLKOUT_From_Irc); /*!&amp;lt; select IRC for CLKOUT */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;CLOCK_SetCoreSysClkDiv(1U);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;POWER_EnablePD(kPDRUNCFG_PD_IRC_OUT); /*!&amp;lt; Disable IRC OUT */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;POWER_EnablePD(kPDRUNCFG_PD_IRC); /*!&amp;lt; Disable IRC */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;/*!&amp;lt; Set SystemCoreClock variable. */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;My version of code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#00FF00"&gt;void Setup_Clock(uint8_t MSel, uint8_t PSel)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;{ &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//No bypass and higher freq range &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;Chip_Clock_SetPLLBypass(FALSE, TRUE);&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//Turn on the SYS OSC by clearing the power down bit&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_SYSOSC_PD);&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//Select the PLL input in the extern ocs&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_SYSOSC);&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//Setup FLASH access to 2 clocks (up to 30MHz)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;Chip_FMC_SetFLASHAccess(FLASHTIM_30MHZ_CPU);&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//Power down PLL to change the PLL divider ratio&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;Chip_SYSCTL_PowerDown(SYSCTL_SLPWAKE_SYSPLL_PD);&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//Configure the PLL M and P dividers&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;Chip_Clock_SetupSystemPLL(MSel, PSel);&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//Turn on the PLL by clearing the power down bit&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_SYSPLL_PD);&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//Wait for PLL to lock&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;while (Chip_Clock_IsSystemPLLLocked() == FALSE) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//Set system clock divider to 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;Chip_Clock_SetSysClockDiv(1);&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;//Set main clock source to the system PLL IN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_PLLIN);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;SystemCoreClockUpdate();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#00FF00"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I am sure I am missing something obvious, any help would be gratefully&amp;nbsp;received.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 12:07:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-System-Oscillator-24MHz-clock-setup-issues/m-p/1502575#M49797</guid>
      <dc:creator>sanders7284</dc:creator>
      <dc:date>2022-08-08T12:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: LPC824 System Oscillator 24MHz, clock setup issues</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-System-Oscillator-24MHz-clock-setup-issues/m-p/1506261#M49855</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/161010"&gt;@sanders7284&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I'm very sorry about the tardy response. Is there any reason why you can't migrate to the newer version, instead of trying to implement the code in the old one? Our recommendation is to always update the software to the latest version.&lt;/P&gt;
&lt;P&gt;That said, there is a basic configuration guide in the User Manual of said device found here:&amp;nbsp;&lt;A href="https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc800-cortex-m0-plus-/low-cost-microcontrollers-mcus-based-on-arm-cortex-m0-plus-cores:LPC82X" target="_blank"&gt;LPC82X | NXP Semiconductors&lt;/A&gt;. It is located in chapter&amp;nbsp;5.3 (Basic configuration);&lt;/P&gt;
&lt;P&gt;"The PLL creates a stable output clock at a higher frequency than the input clock. If you &lt;BR /&gt;need a main clock with a frequency higher than the 12 MHz IRC clock, use the PLL to &lt;BR /&gt;boost the input frequency"&lt;/P&gt;
&lt;P&gt;Hope you find this useful, and again, sorry for the late response.&lt;/P&gt;
&lt;P&gt;Best regards, Julian&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 16:27:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-System-Oscillator-24MHz-clock-setup-issues/m-p/1506261#M49855</guid>
      <dc:creator>Julián_AragónM</dc:creator>
      <dc:date>2022-08-15T16:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: LPC824 System Oscillator 24MHz, clock setup issues</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-System-Oscillator-24MHz-clock-setup-issues/m-p/1506647#M49859</link>
      <description>&lt;P&gt;Thanks Julian,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't update the SDK as this project is based on an existing one with ten's of millions of service hours and industry approvals.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't actually need the PLL as I have a 24MHz external oscillator, but it looks like you can only route this in the 824 as PLLIN (the 844 &amp;amp; 845 have exeocs linkage), so my question was can you use PLLIN without the PLL being set up?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;In effect I want this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="paulsanders_0-1660636098351.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/190319i2B263E888D8BAFAD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="paulsanders_0-1660636098351.png" alt="paulsanders_0-1660636098351.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As that did not seem to work, I thought maybe the PLL needs to be active to use PLLIN?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 07:49:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-System-Oscillator-24MHz-clock-setup-issues/m-p/1506647#M49859</guid>
      <dc:creator>sanders7284</dc:creator>
      <dc:date>2022-08-16T07:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: LPC824 System Oscillator 24MHz, clock setup issues</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-System-Oscillator-24MHz-clock-setup-issues/m-p/1506768#M49861</link>
      <description>&lt;P&gt;This code now works, issue put down to GPIO pinmode, and active pull up or pull downs?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void SetForExtrnlXtal (void)&lt;BR /&gt;{&lt;BR /&gt;uint32_t reg;&lt;BR /&gt;//sys osc bypass options&lt;BR /&gt;#define SYSOSC_BYPASS_DISABLE 0&lt;BR /&gt;#define SYSOSC_BYPASS_ENABLE 1&lt;BR /&gt;#define LO_FREQ_XTAL 0 // set when xtal in range of 1 - 20MHz&lt;BR /&gt;#define HI_FREQ_XTAL 1 // set when xtal in range of 15 - 25MHz&lt;BR /&gt;&lt;BR /&gt;//CRTSTAL PIN - pins 8 and 9 set for external crystal&lt;BR /&gt;Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM); // Enable the clock to the Switch Matrix to save power&lt;BR /&gt;Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON); // Enable clk for IO config&lt;BR /&gt;Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, PORT0, 8, GPIO_INPUT); // Set port p0.8 to input for XTAL IN&lt;BR /&gt;Chip_IOCON_PinSetMode(LPC_IOCON, IOCON_PIO8, PIN_MODE_INACTIVE);&lt;BR /&gt;Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, PORT0, 9, GPIO_INPUT); // Set port p0.9 to input for XTAL OUT&lt;BR /&gt;Chip_IOCON_PinSetMode(LPC_IOCON, IOCON_PIO9, PIN_MODE_INACTIVE);&lt;BR /&gt;Chip_SWM_EnableFixedPin(SWM_FIXED_XTALIN);&lt;BR /&gt;Chip_SWM_EnableFixedPin(SWM_FIXED_XTALOUT);&lt;BR /&gt;Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM); // Disable the clock to the Switch Matrix to save power&lt;BR /&gt;Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_IOCON); // done with the general port pins&lt;BR /&gt;// Going to use internal OScillator with external crystal, set frequency range as appropriate&lt;BR /&gt;Chip_Clock_SetPLLBypass(SYSOSC_BYPASS_DISABLE , HI_FREQ_XTAL); // (bool bypass, bool highfr)&lt;BR /&gt;&lt;BR /&gt;//power up sys osc&lt;BR /&gt;Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_SYSOSC_PD); // power up oscillator&lt;BR /&gt;//delay for power up&lt;BR /&gt;for (reg=0; reg&amp;lt;200; reg++) // give some time to stabilise&lt;BR /&gt;asm("nop");&lt;BR /&gt;&lt;BR /&gt;// Set PLL Source to external crystal&lt;BR /&gt;Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_SYSOSC);&lt;BR /&gt;for (reg=0; reg&amp;lt;200; reg++) // give some time to stabilise&lt;BR /&gt;asm("nop");&lt;BR /&gt;&lt;BR /&gt;// Set main clock&lt;BR /&gt;Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_PLLIN); // ???? (CHIP_SYSCTL_CLKOUTSRC_T src, uint32_t div)&lt;BR /&gt;while (!(LPC_SYSCTL-&amp;gt;MAINCLKUEN&amp;amp;0x01));&lt;BR /&gt;//set system clock divider&lt;BR /&gt;LPC_SYSCTL-&amp;gt;SYSAHBCLKDIV = 1;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 10:49:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC824-System-Oscillator-24MHz-clock-setup-issues/m-p/1506768#M49861</guid>
      <dc:creator>sanders7284</dc:creator>
      <dc:date>2022-08-16T10:49:26Z</dc:date>
    </item>
  </channel>
</rss>

