AnsweredAssumed Answered

Bug in SDK system_LPC802.c returning SystemCoreClock?

Question asked by Karlheinz Wuersch on Apr 30, 2019
Latest reply on Jun 12, 2019 by ZhangJennie

Original code in system_LPC802.c:

 

void SystemCoreClockUpdate (void) {

 

  switch (SYSCON->MAINCLKSEL & 0x03) {
    case 0:                                       /* Free running oscillator (FRO) */
      SystemCoreClock = g_Fro_Osc_Freq;
      break;
    case 1:                                       /* System oscillator */
      SystemCoreClock = CLK_OSC_IN;
      break;
    case 2:                                       /* low power oscillator */
      SystemCoreClock = CLK_OSC_LP;
      break;
    case 3:                                       /* Free running oscillator (FRO) / 2 */
      SystemCoreClock = (g_Fro_Osc_Freq >> 1);
      break;
  }

 

  SystemCoreClock /= SYSCON->SYSAHBCLKDIV;
}

 

... returns the wrong frequency?

 

I have replaced  g_Fro_Osc_Freq  with CLOCK_GetFroFreq() or  (g_Fro_Osc_Freq   / 2).

 

Correct?

Outcomes