Skip to content

Commit

Permalink
edit system_W7500.c / h
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkim committed Nov 20, 2017
1 parent 38e99bf commit 97b8c1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern "C" {
#include "W7500x.h"

extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern uint32_t SystemFrequency; /*!< System Clock Frequency (Core Clock) */
extern uint32_t GetSystemClock(void); /*!< Get System Clock Frequency */


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,22 @@ uint32_t SystemCoreClock = 0; /*!< Processor Clock Frequency */
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
{
//SystemCoreClock = XTAL;
uint8_t M,N,OD;

#ifdef SYSCLK_EXTERN_OSC
CRG->PLL_IFSR = CRG_PLL_IFSR_OCLK;
#else
CRG->PLL_IFSR = CRG_PLL_IFSR_RCLK;
#endif
OD = (1 << (CRG->PLL_FCR & 0x01)) * (1 << ((CRG->PLL_FCR & 0x02) >> 1));
N = (CRG->PLL_FCR >> 8 ) & 0x3F;
M = (CRG->PLL_FCR >> 16) & 0x3F;

#ifdef SYSCLK_EXTERN_OSC
SystemCoreClock = EXTERN_XTAL * M / N * 1 / OD;
#else
SystemCoreClock = INTERN_XTAL * M / N * 1 / OD;
#endif
}

uint32_t GetSystemClock()
Expand Down

0 comments on commit 97b8c1e

Please sign in to comment.