[ARM] How to start the PLL on LPC1343 PLL

Status
Not open for further replies.

Ricardo_Electropepper

Member level 3
Joined
Mar 18, 2014
Messages
59
Helped
4
Reputation
8
Reaction score
4
Trophy points
8
www.electropepper.org
Activity points
407
Im trying to make the routine to star the PLL on LPC1343,

so far i wrote this based in someone else code :

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
void InitPLL (void) {
 
    PDRUNCFG |= 0x00000080;         // Set SYSPLL_PD
 
    SYSPLLCLKUEN &= ~0x00000001;  // No change
    SYSPLLCLKSEL = 0x00000001;      // System oscillator
    SYSPLLCLKUEN |= 0x00000001;     // Update clock source
 
    SYSPLLCTRL = 0x00000025;        // FCLKOUT = 72 MHz /// M div = 6 / P div = 2
    PDRUNCFG &= ~0x00000080;        // Set SYSPLL_PD
 
    while(!(SYSPLLSTAT & 0x000000001)){}  //If 1 -> PLL locked
}



Ive been googling around and there is not much about it, since most people just uses CMSIS.
Does anyone knows how to start the PLL properly ?
 

can you not simulation ?you can use the jlink or ulink to view the register value....
 

Have you checked the CMSIS code for it?

Here is the relevant part I think:

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void SystemInit (void)
{
#if (CLOCK_SETUP)                                 /* Clock Setup              */
#if (SYSCLK_SETUP)                                /* System Clock Setup       */
#if (SYSOSC_SETUP)                                /* System Oscillator Setup  */
  uint32_t i;
 
  LPC_SYSCON->PDRUNCFG     &= ~(1 << 5);          /* Power-up System Osc      */
  LPC_SYSCON->SYSOSCCTRL    = 0x00;
  for (i = 0; i < 200; i++) __NOP();
  LPC_SYSCON->SYSPLLCLKSEL  = 0x01;   /* Select PLL Input         */
  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;               /* Update Clock Source      */
  LPC_SYSCON->SYSPLLCLKUEN  = 0x00;               /* Toggle Update Register   */
  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;
  while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));     /* Wait Until Updated       */
#if (SYSPLL_SETUP)                                /* System PLL Setup         */
  LPC_SYSCON->SYSPLLCTRL    = SYSPLLCTRL_Val;
  LPC_SYSCON->PDRUNCFG     &= ~(1 << 7);          /* Power-up SYSPLL          */
  while (!(LPC_SYSCON->SYSPLLSTAT & 0x01));       /* Wait Until PLL Locked    */
#endif
#endif



It might be outdated since it is from CMSIS 1.3 but it works fine.

At first glance it seems that you are doing the update sequence incorrectly.
 

Gracias caiomarcos , im still looking at the CMSIS, i came from the PIC world where i only used assembly, so C language is still a bit new to me and im still having some trouble to reuse others code whitout fully undestanding it, for example i can find that function anywhere in CMSIS 3.01.
 


I believe you meant you CAN NOT find that anywhere, and you won't. I said CMSIS but it is actually in a package supplied by NXP, sorry: http://www.lpcware.com/content/faq/lpcxpresso/cmsis-support

You should look into system_LPC13xx. and LPC13xx.h for mcu specifics, such as the SystemInit function. With that, and the core header files, I believe you will be able to solve a lot of problems.
 
Last edited:

Sorry people, i indeed wanted to say i CAN NOT, so resuming, in the CMSIS i can find ONLY the header files with all the right names for the registers in structs also the linkerscript and assembly startup files, and the actually C files with the functions i will find on examples from the manufacturer ?

By the way i registered in arm.com and got the original CMSIS from them for cortex m3.
 

Yes, I believe the .c and .h files with functions specific to each mcu are supplied by the vendor, at least that's what NXP does for the LPC1343.

So, on the NXP website you can find a package (http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc13xx-packages) with the core files for cortex m3 plus the specific c files for the LPC1343. In one of those specific files (system_LPC13xx.c) you will find the system start up function, from there you can see what should be done to correctly start the mcu, including the PLL.
 
The AN mentioned deals with a complete different thing, and since it says that it is applicable to both LPC111x and LPC13xx, I believe they are not so different regarding UART functionality.
After a quick glance, it looks like the clock generation block is very similar for both, including PLL. Values vary, and MAYBE the routine to start the PLL, but I can't say for sure.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…