본문 바로가기

[NXP]/LPC1700

[LPC1756 EVM] Cortex-M3 LPC1700 GPIO 속도 테스트 실험

[LPC1756 EVM] Cortex-M3 LPC1700 GPIO 속도 테스트 실험



NXP사의 100Mhz Corte-M3 LPC1756 의 GPIO토글링 속도 테스트를 실험해 보았다. [다른 MCU속도 측정 결과]와 비교 하면 PIC32정도와 비교할 만하다.

비트 토글시 4.5Mhz정도 출력된다. PLL세팅 하여 100Mhz로 구동하니 8Mhz 정도 나온다.
     14              while(1)
     15              {
     16                  Led1Toggle();   /FIO1PIN ^= BIT9
   \                     ??main_1:
   \   00000034   2068               LDR      R0,[R4, #+0]
   \   00000036   4840               EORS     R0,R1,R0
   \   00000038   2060               STR      R0,[R4, #+0]
   \   0000003A   FBE7               B.N      ??main_1
   \                     ??main_0:
   \   0000003C   34C00920           DC32     0x2009c034
   \   00000040                      REQUIRE _A_FIO1PIN




단순 On/Off 만 했을때 25Mhz까지 출력된다.
     14              while(1)
     15              {
     16                  FIO1SET = BIT9;
   \                     ??main_1:
   \   00000034   6060               STR      R0,[R4, #+4]
     17                  FIO1CLR = BIT9;
   \   00000036   A060               STR      R0,[R4, #+8]
   \   00000038   FCE7               B.N      ??main_1
   \   0000003A   00BF               Nop     
   \                     ??main_0:
   \   0000003C   34C00920           DC32     0x2009c034
   \   00000040                      REQUIRE _A_FIO1PIN
   \   00000040                      REQUIRE _A_FIO1SET
   \   00000040                      REQUIRE _A_FIO1CLR






LPC1756 PLL 설정 코드 - 100Mhz 설정
void ConfigurePLL ( void )
{
DWORD MValue, NValue;

  if ( PLL0STAT & (1 << 25) )
  {
    PLL0CON = 1;     /* Enable PLL, disconnected */
    PLL0FEED = 0xaa;
    PLL0FEED = 0x55;
  }

  PLL0CON = 0;       /* Disable PLL, disconnected */
  PLL0FEED = 0xaa;
  PLL0FEED = 0x55;

  SCS |= 0x20;      /* Enable main OSC */
  while( !(SCS & 0x40) ); /* Wait until main OSC is usable */

  CLKSRCSEL = 0x1;    /* select main OSC, 12MHz, as the PLL clock source */

  PLL0CFG = PLL_MValue | (PLL_NValue << 16);
  PLL0FEED = 0xaa;
  PLL0FEED = 0x55;

  PLL0CON = 1;       /* Enable PLL, disconnected */
  PLL0FEED = 0xaa;
  PLL0FEED = 0x55;
 
 CCLKCFG = CCLKDivValue; /* Set clock divider */
  #if USE_USB
    USBCLKCFG = USBCLKDivValue;   /* usbclk = 288 MHz/6 = 48 MHz */
  #endif

  while ( ((PLL0STAT & (1 << 26)) == 0) ); /* Check lock bit status */

  MValue = PLL0STAT & 0x00007FFF;
  NValue = (PLL0STAT & 0x00FF0000) >> 16;
  while ((MValue != PLL_MValue) && ( NValue != PLL_NValue) );

  PLL0CON = 3;       /* enable and connect */
  PLL0FEED = 0xaa;
  PLL0FEED = 0x55;
  while ( ((PLL0STAT & (1 << 25)) == 0) ); /* Check connect bit status */
  return;
}


void SystemInit(void)
{
  // Flash accelerator init
  FLASHCFG = (0x5UL<<12) | 0x3AUL;
  // Init clock
  InitClock();
#if FCCLK_FREQ < 20000000
  FLASHCFG = (0x0UL<<12) | 0x3AUL;
#elif FCCLK_FREQ < 40000000
  FLASHCFG = (0x1UL<<12) | 0x3AUL;
#elif FCCLK_FREQ < 60000000
  FLASHCFG = (0x2UL<<12) | 0x3AUL;
#elif FCCLK_FREQ < 80000000
  FLASHCFG = (0x3UL<<12) | 0x3AUL;
#elif FCCLK_FREQ < 100000000
  FLASHCFG = (0x4UL<<12) | 0x3AUL;
#endif 
   :
}
반응형