lpcware

2 problem in  system_LPC13xx.c file

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by zaalzaalak on Tue Jan 10 03:37:14 MST 2012
Hello

I see this code lines in system_LPC13xx.c for clock update:

  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       */

but it seems that lines 1 and 4 in above code is useless because in datasheet UM10375.pdf we see:

In order for the update to take effect, first write a zero to the SYSPLLUEN register and then write a one to SYSPLLUEN.

why we first one in code?
why we check ENA bit going low?there is not note about this in datasheet.(line4)


-------------
In line 352 ( system_LPC13xx.c ) we have:

           if (LPC_SYSCON->SYSPLLCTRL & 0x180) {

but in SYSPLLCTRL register bit 0~6 are used and others are reserved,why in above bits 8 and 7 are used in if statement?









Outcomes