Setting PIC32MX and PIC32MZ Clock Options

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Setting PIC32MX and PIC32MZ Clock Options

Post by Brendan »

Re-posting my comments made elsewhere...

Hi Guys.

As MX and MZ clock settings feature strongly in this thread, I thought I'd share something that I came across and enabled me to quickly confirm appropriate clock settings and transfer them to configuration option in Flowcode. No reliance on Harmony or other info, and it just worked!

I therefore recommend downloading Microchip's MX and MZ Oscillator Configurator Excel workbook (there are separate worksheets for each PIC type) from here:
https://microchipdeveloper.com/32bit:mz-osc

The linked page also provides other relevant information on clock settings for improved understanding.

Simply adjust your settings in the applicable worksheet (which incidentally red flags any settings that are out of bounds), transfer them to Flowcode configuration option registers by the same name as those featured in the spreadsheet, and declare SPLL as your clock speed under Flowcode "General Options".

Enjoy!

All the best,
Brendan

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: Setting PIC32MX and PIC32MZ Clock Options

Post by stefan.erni »

Hello Brendan

Yes that's very nice. Thank's a lot.

So you can quickly and easily change clock properties.
There is a way to do this during the program. Somehow with the unlook sequences and keyword (syskey). I only suspect that. But putting the PIC in a power-saving mode would be a good thing. As an example, you would have to set FPLLMULT (system PLL multiplier) from 50 to 25 and in the general option clockspeed from 200,000,000 to 100,000,000 and this already saves 30% power. With your Excel you have a good overview of which clock speeds you can reduce and which ones better not.

regards

Stefan
clock_mod.PNG
(9.17 KiB) Downloaded 1517 times
clock_mod2.PNG
(186.5 KiB) Downloaded 1517 times

Post Reply