CMSIS Library V1.3 (Dec 8, 2009) bug

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CMSIS Library V1.3 (Dec 8, 2009) bug

1,125 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by RoadRanger on Wed Jan 26 20:38:52 MST 2011
The system_LPC11xx.c file will brick your target if you:
System Oscillator Enable = unchecked
Select Input Clock for sys_pllclkin = IRC Oscillator
Select Input Clock for Main clock = System PLL Clock Out

The problem is the PLL is never started if the System Oscillator is disabled .

It can be fixed by moving a single #endif statement :

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    = SYSOSCCTRL_Val;
  for (i = 0; i < 200; i++) __NOP();
  LPC_SYSCON->SYSPLLCLKSEL  = SYSPLLCLKSEL_Val;   /* 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       */
#endif
#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
#if (WDTOSC_SETUP)                                /* Watchdog Oscillator Setup*/
  LPC_SYSCON->WDTOSCCTRL    = WDTOSCCTRL_Val;
  LPC_SYSCON->PDRUNCFG     &= ~(1 << 6);          /* Power-up WDT Clock       */
#endif
  LPC_SYSCON->MAINCLKSEL    = MAINCLKSEL_Val;     /* Select MCLK Clock Source  */
  LPC_SYSCON->MAINCLKUEN    = 0x01;               /* Update MCLK Clock Source */
  LPC_SYSCON->MAINCLKUEN    = 0x00;               /* Toggle Update Register   */
  LPC_SYSCON->MAINCLKUEN    = 0x01;
  while (!(LPC_SYSCON->MAINCLKUEN & 0x01));       /* Wait Until Updated       */
#endif

  LPC_SYSCON->SYSAHBCLKDIV  = SYSAHBCLKDIV_Val;
  LPC_SYSCON->SYSAHBCLKCTRL = AHBCLKCTRL_Val;
  LPC_SYSCON->SSP0CLKDIV    = SSP0CLKDIV_Val;
  LPC_SYSCON->UARTCLKDIV    = UARTCLKDIV_Val;
  LPC_SYSCON->SSP1CLKDIV    = SSP1CLKDIV_Val;
#endif


#if (MEMMAP_SETUP || MEMMAP_INIT)       /* Memory Mapping Setup               */
  LPC_SYSCON->SYSMEMREMAP = SYSMEMREMAP_Val;
#endif
}
0 Kudos
Reply
5 Replies

1,096 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by OXO on Tue Aug 16 01:28:34 MST 2011
The code for SystemInit in CMSIS v2.00 is completely different to that posted above.

Are you using v2.00?
0 Kudos
Reply

1,096 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by HankKauffmann on Mon Aug 15 07:39:22 MST 2011
The problem is still in the latest  downloads from both NXP & IAR.

My tool chain is IAR 6.20, and my custom board has an LPC1313 that doesn't have a crystal or use CodeRed but does use CMSIS.

BTW: powering up SYSOSC (which is the default for this file) affects SYSPLL when there is no crystal attached.
0 Kudos
Reply

1,096 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sarmitage on Tue Jul 05 07:30:30 MST 2011
Thank you for posting this.  I can confirm that the CMSIS code is wrong and the suggested correction allows the PLL to function if SYSOSC_SETUP is undefined. 

I am surprised that this issue has not gotten more visibility.  The LPC11xx has an excellent internal oscillator that would avoid the need for a crystal in many applications, so that a functional system can be made using only the micro plus bypass caps.  Maybe there should be an app note on using the LPC11xx/LPCXpresso without a crystal.
0 Kudos
Reply

1,096 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Thu Jan 27 19:14:37 MST 2011
Which development tool are you using to configure this library?

Thanks,
-NXP
0 Kudos
Reply

1,096 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Jan 27 01:07:57 MST 2011
Thank you for the feedback. We'll discuss this with the appropriate team at NXP.

Regards,
CodeRedSupport
0 Kudos
Reply