Page 1 of 1

DSPIC33EPxxx Internal Oscillator setup

Posted: Thu Jun 28, 2018 1:34 pm
by JustinS
I'm starting testing Flovcode V8 and DSPIC programming.
I test DSPIC3EP128MC202.
I searched the entire forum and can not find the C code for the internal oscillator configuration for the 140MHz frequency.
IntOsc Helper shows nothing
I am asking for quick help
:|

Re: DSPIC33EPxxx Internal Oscillator setup

Posted: Fri Jun 29, 2018 10:00 am
by celebriums
Hi Justin

It will work if you make the settings as below.

Menu> Project Options> General Options
ClockSpeed 8Mhz (internal speed up to 8 Mhz is not 140 Mhz. )

Menu> Project Options> Configure

_FCID 0xFFEF
_FPOR 0xFFFF
_WDT 0xFF7F
_FOSC 0xFFBF
_FOSCSEL 0xFFF8 (INT Fast RC (FRC))
_FGS 0xFFFF

Re: DSPIC33EPxxx Internal Oscillator setup

Posted: Fri Jun 29, 2018 11:25 am
by JustinS
Thank you celebriums
I will try your setting.
Two years ago I used the following code in C.
And it worked OK.
I just found him today

//Setup configuration for 138.1875MHz or 69MIPs using 7.37MHz Internal Osc
PLLFBD = 73;// M=75
CLKDIVbits.PLLPOST = 0;// N1=2
CLKDIVbits.PLLPRE = 0;// N2=2
OSCTUN = 0;//Tune FRC oscillator, if FRC is used

//Disable Watch Dog Timer
RCONbits.SWDTEN = 0;// Clock switching to incorporate PLL

__builtin_write_OSCCONH(0x01);// Initiate Clock Switch to FRC

// Oscillator with PLL (NOSC=0b011)
__builtin_write_OSCCONL(0x01);// Start clock switching

while(OSCCONbits.COSC != 0b001);

// Wait for Clock switch to occur
while(OSCCONbits.LOCK != 1);