I am working with MK66 MCU .
I need to set clock frequency for Ethernet(RMII Mode), I am giving 50MHZ oscillator clock frequency to both EXTAL0 pin(PIN 72) as well as Ethernet PHY(LAN8710). How can I get desired Core , flash, flex, bus clocks by choosing EXTAL0 pin(50MHZ) as Source clock and not giving any source clock for XTAL32 and EXTAL32 pins.
My requirement is :
Core clock : 180MHZ
Flex clock: 60MHZ
Bus clock : 60MHZ
Flash clock : 25.5 MHZ.
I am getting 50MHZ clock frequency in OSCERCLK( pin 106).according to the reference manual RMII mode takes oscerclk as input for its operation do we have change any registers values. Iam not giving clock to the XTAL32.
Now, clock working fine but iam not getting any out at TD0&TD1 also not getting any interrupt.
Hi,
Which pin is TD0 and TD1?
BR
Xiangjun Rong
trnsmitte pins 68 & 69 and transmitte Enable pins . these signals are not going to state changes.
Hi, all,
I suppose that you configure the pin68 of K66 as RMII0_TXD0/MII0_TXD0, configure the pin69 as RMII0_TXD1/
MII0_TXD1.
In the above case, you have to use the code to configure the two pin:
CLOCK_EnableClock(kCLOCK_PortA);
PORT_SetPinMux(PORTA, 16u, kPORT_MuxAlt4);
/* Affects PORTA_PCR17 register */
PORT_SetPinMux(PORTA, 17u, kPORT_MuxAlt4);
Furthermore, I suggest you download SDK2.0 of K66, there is example of LWIP.
C:\Freescale\SDK2.0_K65\boards\twrk65f180m\demo_apps\lwip
and
C:\Freescale\SDK2.0_K65\boards\twrk65f180m\driver_examples\enet\txrx_transfer
You can download SDK2.0 from the website:
Hope it can help you
BR
XiangJun rong
Hi, karthik,
As a simple way, you can read the registers in MCG module with tools debugger and figure out the above clock frequency. As an alternative, you can connect the pin CLKOUT(PTA6 for K66) to scope and have BUS clock output CLKOUT pin by setting the CLKOUTSEL as 3b'000, in this way, you can derivate the other clock source frequency by reading the SIM_CLKDIV1 register.
Hope it can help you
BR
Xiangjun rong
Can I generate 180 Mhz without using the clock from EXTAL0 .
Hi, Karthik,
If you do not use external crystal or clock source from EXTAL0/Xtal0 pins, you have to use internal clock source. First of all, the internal PLL can NOT output 180mhz clock signal, you have to use PLL plus internal clock source. For K66, I think you can use 48MHz interncl clock source and PLL so that PLL can output 180MHz clock signal.
But for your case, now that you have 50MHz clock source connected to EXTAL0, why do you use it to generate 180mHz clock signal as core/system clock source.
As you know that the PLL input clock frequency is limited from 8MHz~16mHz, Pls refer to Figure 27-1. Multipurpose Clock Generator (MCG) block diagram in RM of K66.
You select the OSC0 clock source which is 50MHz, PRDIV=4, the PLL input clock source is 50MHz/(4+1)=10MHz. set VDIV=5b'00010(multiply is 18), the VCO output clock is (50MHz/5)*18*2=360MHz, the VCO/2=180MHz, which is core/system clock.
Regarding the code, I think you can create a simple project based KDS tools, select the TWR-K65, the tools can generate the clock code. If you define the #define CLOCK_SETUP 1 in system_MK65F18.h, the MCG will use PEE mode and generate 180MHz as core/system clock. If you use K66, you can copy the snippet of the code. Before you use the code, pls check the MCG register setting based on your input clock from EXTAL pin.
Hope it can help you
BR
XiangJun Rong