pic24ep256gp206 how to it run on 70Mhz

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

pic24ep256gp206 how to it run on 70Mhz

Post by stefan.erni »

I have a problem with a pic24ep256gp206.
I chosed 70 000 000 Hz for the delay and IRQ.
In the progam I made a delay of 1 Second but the delay is about 10 seconds.
Can I put an C-Code to config it to 70Mhz?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: pic24ep256gp206 how to it run on 70Mhz

Post by Benj »

Hello,

We advise a 1 second flash test to help get the device running at the correct speed.

https://www.matrixtsl.com/wikiv7/index. ... ED_flasher

What value of crystal are you using? If you are using a crystal? and I will see if I can get you some code to configure the onboard PLL to give you the clock speed you're after.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: pic24ep256gp206 how to it run on 70Mhz

Post by stefan.erni »

Hi Ben
I dont use a quarz
I did the test like in the wiki..

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: pic24ep256gp206 how to it run on 70Mhz

Post by Benj »

Hello,

You will need to do something like this in a C icon.

Refer to the device datasheet to double check the values make sense for your device.

Note that this isn't for 70MHz operation, I beleive I run it slower to save on power but it's been a while since I wrote this so I can't really remember why it's not at full speed.

Code: Select all

//Setup configuration for 79.2275MHz or 39.61375MIPs
PLLFBD = 41;// M=43
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);

/*
//USB H/W initialization for 70 MIPs
ACLKCON3 = 0x24C1;
ACLKDIV3 = 0x7;// Wait for PLL to lock
ACLKCON3bits.ENAPLL = 1;
while(ACLKCON3bits.APLLCK != 1);
*/

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: pic24ep256gp206 how to it run on 70Mhz

Post by stefan.erni »

Hi Ben

Thank You. It's working with around 79.2275MHz now.
I controlled it with the osciloscope.
In the attachment I have the another settings of the Project Option, for the clock, if somebody need it.
clock_settings_pic24EP.PNG
(37.76 KiB) Downloaded 3372 times

Post Reply