Created Tue, 03 Jun 2014 17:39:36 +0000 by black_manta
Tue, 03 Jun 2014 17:39:36 +0000
Hi,
I posted previously about a board running slow, and while I follow the example code for setting up the PLLs, I'm still not sure if I'm doing it right. to verify that I had done it right, I tried setting the oscillator output, so I can measure the Fcy frequency with a scope.
has anyone set up the PLLs and OSCIOFNC using MPlab-X? here is what I'm doing:
#pragma config FNOSC = PRIPLL // Oscillator selection #pragma config POSCMOD = EC // Primary oscillator mode #pragma config FPLLIDIV = DIV_2 // PLL input divider #pragma config FPLLMUL = MUL_20 // PLL multiplier #pragma config FPLLODIV = DIV_1 // PLL output divider #pragma config FPBDIV = DIV_8 // Peripheral bus clock divider #pragma config FSOSCEN = OFF // Secondary oscillator enable
#pragma config OSCIOFNC = ON // Clock output on OSCO pin enable
Tue, 03 Jun 2014 18:03:24 +0000
These are all the #pragma settings from the bootloader source for the Cerebot MX7cK:
//* Oscillator Settings
#pragma config FNOSC = PRIPLL // Oscillator selection
#pragma config POSCMOD = XT // Primary oscillator mode
#pragma config FPLLIDIV = DIV_2 // PLL input divider
#pragma config FPLLMUL = MUL_20 // PLL multiplier
#pragma config FPLLODIV = DIV_1 // PLL output divider
#pragma config FPBDIV = DIV_1 // Peripheral bus clock divider
#pragma config FSOSCEN = OFF // Secondary oscillator enable
//* Clock control settings
#pragma config IESO = OFF // Internal/external clock switchover
#pragma config FCKSM = CSDCMD // Clock switching (CSx)/Clock monitor (CMx)
#pragma config OSCIOFNC = OFF // Clock output on OSCO pin enable
//* Other Peripheral Device settings
#pragma config FWDTEN = OFF // Watchdog timer enable
#pragma config WDTPS = PS1024 // Watchdog timer postscaler
//* Code Protection settings
#pragma config CP = OFF // Code protection
#pragma config BWP = OFF // Boot flash write protect
#pragma config PWP = OFF // Program flash write protect
//* Debug settings
#pragma config ICESEL = ICS_PGx1 // ICE pin selection
//* Other Peripheral Device settings
#pragma config FSRSSEL = PRIORITY_7 // SRS interrupt priority
#pragma config FCANIO = OFF // Standard/alternate CAN pin select (OFF=Alt)
#pragma config FETHIO = ON // Standard/alternate ETH pin select (OFF=Alt)
#pragma config FMIIEN = OFF // MII/RMII select (OFF=RMII)
//* USB Settings
#pragma config UPLLEN = ON // USB PLL enable
#pragma config UPLLIDIV = DIV_2 // USB PLL input divider
#pragma config FVBUSONIO = OFF // VBUS pin control
#pragma config FUSBIDIO = OFF // USBID pin control
Just changing the OSCIOFNC=OFF to OSCIOFNC=ON should achieve what you want.
I notice those settings are using the XT (crystal) setting, not the EC (External Clock) setting. Keith / Brian - can you confirm that's right / wrong? Are current MX7cK boards shipping with external clocks or with crystals?