PIC32 external osc help - Page 1
Forum section: electronics / general

author: mapexmbirch
author_rank: Contributor
timestamp: March 22, 2017, 04:50:19 pm
content: HiI have a PIC32MZ1024EF064 with a 8MHz external resonator.http://onecall.farnell.com/murata/cstce8m00g52a-r0/resonator-ceramic-8mhz-smd/dp/2443267?ost=CSTCE8M00G52A-R0&selectedCategoryId=&categoryNameResp=All&searchView=table&iscrfnonsku=falseI have used this resonator before on a PIC18 and PIC24, both worked fine.I can get my code to work fine with the internal FRC (8MHz), but when I switch it to the external osc, it doesn't start and it uses the other internal osc.My setup code:Code:#pragma config FMIIEN = ON // Ethernet RMII/MII Enable (MII Enabled)#pragma config FETHIO = ON // Ethernet I/O Pin Select (Default Ethernet I/O)#pragma config PGL1WAY = ON // Permission Group Lock One Way Configuration (Allow only one reconfiguration)#pragma config PMDL1WAY = ON // Peripheral Module Disable Configuration (Allow only one reconfiguration)#pragma config IOL1WAY = ON // Peripheral Pin Select Configuration (Allow only one reconfiguration)#pragma config FUSBIDIO = OFF // USB USBID Selection (Controlled by the USB Module)// DEVCFG2#pragma config FPLLIDIV = DIV_1 // System PLL Input Divider (1x Divider)#pragma config FPLLRNG = RANGE_5_10_MHZ // System PLL Input Range (8-16 MHz Input)#pragma config FPLLICLK = PLL_POSC // System PLL Input Clock Selection (POSC is input to the System PLL)#pragma config FPLLMULT = MUL_45 // System FRC Multiplier (FRC Multiply by 45)#pragma config FPLLODIV = DIV_2 // System PLL Output Clock Divider (2x Divider)#pragma config UPLLFSEL = FREQ_12MHZ // USB PLL Input Frequency Selection (USB PLL input is 12 MHz)// DEVCFG1#pragma config FNOSC = SPLL // Oscillator Selection Bits (Primary Osc (HS,EC))#pragma config DMTINTV = WIN_127_128 // DMT Count Window Interval (Window/Interval value is 127/128 counter value)#pragma config FSOSCEN = OFF // Secondary Oscillator Enable (Disable SOSC)#pragma config IESO = OFF // Internal/External Switch Over (Disabled)#pragma config POSCMOD = HS // Primary Oscillator Configuration (HS osc mode)#pragma config OSCIOFNC = OFF // CLKO Output Signal Active on the OSCO Pin (Disabled)#pragma config FCKSM = CSDCMD // Clock Switching and Monitor Selection (Clock Switch Enabled, FSCM Enabled)#pragma config WDTPS = PS1048576 // Watchdog Timer Postscaler (1:1048576)#pragma config WDTSPGM = STOP // Watchdog Timer Stop During Flash Programming (WDT stops during Flash programming)#pragma config WINDIS = NORMAL // Watchdog Timer Window Mode (Watchdog Timer is in non-Window mode)#pragma config FWDTEN = OFF // Watchdog Timer Enable (WDT Disabled)#pragma config FWDTWINSZ = WINSZ_25 // Watchdog Timer Window Size (Window size is 25%)#pragma config DMTCNT = DMT31 // Deadman Timer Count Selection (2^31 (2147483648))#pragma config FDMTEN = OFF // Deadman Timer Enable (Deadman Timer is disabled)// DEVCFG0#pragma config DEBUG = OFF // Background Debugger Enable (Debugger is disabled)#pragma config JTAGEN = OFF // JTAG Enable (JTAG Disabled)#pragma config ICESEL = ICS_PGx1 // ICE/ICD Comm Channel Select (Communicate on PGEC1/PGED1)#pragma config TRCEN = ON // Trace Enable (Trace features in the CPU are enabled)#pragma config BOOTISA = MIPS32 // Boot ISA Selection (Boot code and Exception code is MIPS32)#pragma config FECCCON = OFF_UNLOCKED // Dynamic Flash ECC Configuration (ECC and Dynamic ECC are disabled (ECCCON bits are writable))#pragma config FSLEEP = OFF // Flash Sleep Mode (Flash is powered down when the device is in Sleep mode)#pragma config DBGPER = PG_ALL // Debug Mode CPU Access Permission (Allow CPU access to all permission regions)#pragma config SMCLR = MCLR_NORM // Soft Master Clear Enable bit (MCLR pin generates a normal system Reset)#pragma config SOSCGAIN = GAIN_2X // Secondary Oscillator Gain Control bits (2x gain setting)#pragma config SOSCBOOST = OFF // Secondary Oscillator Boost Kick Start Enable bit (Normal start of the oscillator)#pragma config POSCGAIN = GAIN_2X // Primary Oscillator Gain Control bits (2x gain setting)#pragma config POSCBOOST = ON // Primary Oscillator Boost Kick Start Enable bit (Boost the kick start of the oscillator)#pragma config EJTAGBEN = NORMAL // EJTAG Boot (Normal EJTAG functionality)I have no idea what you should look for when selecting an resonator.When I probe the pins there is about 0.5V of DC on one pin and 0V on the other. A picture of how I connected it to the PIC is attached.Any help would be greatly appreciated!

author: Lunasix
author_rank: Regular Contributor
timestamp: March 22, 2017, 05:01:23 pm
content: Read the errata !