logo
background
 Home and Links
 Your PC and Security
 Server NAS
 Wargames
 Astronomy
 PhotoStory
 DVD making
 Raspberry Pi
 PIC projects
 Other projects
 Next >>

PIC Overclocking

PIC overclocking

How fast can you run your PIC ?

The £4 Pi Zero with a £1 4Gb SDHC (for program space) is so powerful (1GHz) and incorporates so much functionality (512Mb RAM, USB 2.0, AV/HDMI etc.) that it's just not worth the effort to use any but the cheapest (30-50p) PIC for the simplest applications. Unfortunately a 30p PIC is usually the lowest speed PIC and sometimes we need to squeeze just a bit more out of them (eg use a 11.0592MHz Xtal for exact baud rate gen. on a 10MHz rated part). So just what can we achieve ?

How all chips got faster

First a bit of background. In the 'good old days' (20+ years ago) the silicon chip inside your DIL package was massive = the reason why some DILs were more than half an inch (0.6") across was due to the size of the chip inside (and not just a marketting trick to get away with charging you extra for a 'big' part that looked 'expensive' :-) ).

Then the chip manufacturers discovered something magic - as they reduced the size of the transistors (and hence the size of the chip) they got faster -- and what's more, the smaller the chip the more they could get onto each silicon wafer (the cost of making chips is essentailly the cost of processing a wafer .. so the more chips you got on each wafer, the cheaper each chip was ro make) !

Every 'generation' of chips were made smaller - and as a 'rule of thumb', when you halve the size you double the speed, get double the number on each wafer and thus half the cost !
 
Chip makers were onto a 'win win' roller coaster .. customers were willing to pay more for faster parts but it actually cost you less to make them faster !
 
However there was a big 'retooling' cost when you changed your production line to make smaller chips - so usually you had to wait until you were bringing out a brand-new new 'generation' of chips (for which you could get an even higher premium price)

So, at the 'leading edge' - mainstream CPU designs (Intel, AMD) and RAM memory (Micron etc) - roughly every 18 months or so, a new generation of chips came out at 'double the speed'. Of course users were prepared to pay extra for the first 'double speed' chips - so there was huge pressure to get your new production line up and running before the competition - and the sooner you could move all your old designs over to the new line (and bang them out for half the cost) the faster you could gain market share (by reducing your price just enough to under-cut the competition) thus leading to ever increasing profits !

What does this means for 'old' PIC designss ?

Microchip didn't want to sell you 4MIz 10F chips that could run at 20MHz. Instead they wanted you to buy the nice new 16F 20MHz versions. However they were selling the 10F's by the multi-million into an existing market - so when the 16F line was up and running, whilst they 'shrunk' the 10F's to 'half size' (so they could get double the number on the new fabrication process) they just left the data sheets (and the prices) the same !

Of course it didn't take long for the hobbyist to discover that they could run the 'new shipped' 4MHz parts at 20MHz ..

Then, about 10 years ago, it was discovered that (some) 16F 20MHz chips could be run at 32MHz just fine .. and as 32MHz was the brand-new 24F 'standard' speed we can assume the 16F's had been 'shrunk' and switched to the 24F production line

When making semiconductor chips, quality varies across the wafter - so whilst the 24F chips were all tested at 32MHz (and those that failed the grade got scrapped) the 16F chips only needed to be tested at 20MHz (so a lot less got thrown away). So not every 20MHz chip will run at 32MHz .. however it seems you can count on every 16F 20MHz chip running just fine at 24MHz (and even the 18F parts can be run at least 10% over their rated 'max.'), especially if you keep the voltages up (again, as a rule of thumb, the higher the voltage the higher the speed).

Where are we today ?

Todays production lines are producing 'top end' 32F PIC's running at hundreds of MHz (as of 2014, 330MHz) - but the specifications for the 'bottom end' chips (which are no doubt being made on the same line) have still not been changed. Although the '4 MHz' chips are no longer made, most of the 16F/18F chips are = and one experimental hobbyist has tested their 'recent production' 16F628A (20MHz = 5MIPS) part and discovered that it would run just fine at 64.5 MHz (16 MIPS) !!

It is to be noted that the PIC's built-in OSC circuit has to support some specified minimum crystal frequency (usually in various software selectable 'modes').
 
As the manufacturing process shrinks the silicon, the OSC drive circuit will have to be redesigned in order to meet the 'minimums'.
 
Plainly this is likely to effect the ability of the same circuit to reach high 'overclock' speeds. So, to get the most out of your PIC, you will have to use an external osc. drive circuit (and get as close to a 1:1 mark/space ratio as you can)
 
The max. frequency possible also depends on the supply voltage. PIC specification sheets show 'stepped' voltage V frequency 'graphs', but in reality the frequency curve is continuous. Since the top frequency 'step' is specified (typically) at 4.5v, and most PIC's can be run at 6.0v (or higher), if you watch the temperature, you can expect to reach 6.0/4.5 = 133% of the rated frequency.
 
Finally. you will typically get 'more out of it' by driving the PIC with an exact 1:1 mark/space external clock (i.e. not using the PIC's own internal Xtal drive circuits and especially not the internal PLL)
Unfortunately the more complex the PIC, the larger the number of internal components it has - and as the die is shrunk, each of these has to be redesigned to meet the 'low-end' of the frequency specification. In particular, many PICs incorporate PLL's that have to be 'tuned' for a specific frequency range. When the fabrication process changes, the actual PLL design has to change to support the bottom end OSC spec. 'mode' - and this means the 'top end' is 'truncated' (i.e. a half-sized die won't have a double speed PLL). However IF you avoid the 'low frequency' design spec. components within the PIC (such as analigue sample hold circuits), the rest of the chip will run just fine at much higher speeds (especially if you drive the PIC with an external OSC and bypass the PLL)

In the April 2006 issue of EPE (Everyday Practical Electronics) test were made using various 'off the shelf' PIC18F devices rated at 32MHz (4x 8MHz OSC) and some 40MHz (4x 10MHz CLK) rated parts. They discovered that ".. the PLL (of both types) limits soon after 40MHz, however the devices reached 60MHz when driven from an Ext Clk" (i.e. without using the internal PLL).

The 'top end' chips of the 18F range are rated at 48MHz. There are many reports that suggest all the 18F series devices (i.e. even the '40 MHz' parts) have an internal PLL that will "always" accept a 12MHz crystal - at least at 5.0v and room tempratures - so you can usually count on getting 48MHz out of the 40MHz parts

Note also that some things (like the ADC) have 'analogue' specs (like set-up / sample hold times), and especially EEPROM (and Flash) 'write' times also have to be met

NB. In general, with crystal (PIC OSC circuit) based overclocking, 'if it starts, it will run'.

What can you expect ?

Those PIC12 class device that are still being made have a specified max. of 32MHz = however they are said to all be 40MHz capable.

The 16Fxxx "20MHz" parts (such as the 16F873A) will generally overclock to at least 32MHz without any problems

The voltage-frequency graph for 16Fx parts shows 4MHz at 2v, 10MHz at 3v then a jump to 20MHz at 4.5v, however this gives us a 'rule of thumb' of +6MHz per volt (starting at 2v, 4MHz). It's possible to run at 6.5v, so that's 2v over 4.5 and thus 12MHz over 20 = 32MHz.

The 18Fxxx "40MHz" parts will all work at 48 MHz even using the PIC OSC and internal x4 PLL (and will often run even faster using an external CLK)

The slower chips of the 18FxxK / 18xxJ range are only rated at 48MHz, whilst you can pay a premium price for the 64MHz rated version. Since they are all made on the same production line it's a guess that the '48MHz' parts are just 'worst case test' failed '64MHz' parts.

Failure to reach the rated speed will occur at the lowest voltage = so if you stick to 5.0v (or above) you will almost certainly get the full 64MHz out of a '48MHz' rated part.
 
There are reports of the 'speed selected' 64MHz parts running at 80-96MHz (even using the internal x4 PLL), again at 5.0v and above.
 
The 'rule of thumb' for 18Fx parts is that the clock speed is 13MHz per volt (so x6.5 = 84MHz !).
 
It's said that devices with EEPROM are (a lot) more over-clockable (so long as you don't use the EEPROM) ..
Note that newer design multi-mega Hz '5v' parts typically have an internal CPU running at 3v3, 2v5 or even 1v8 = so these will all have internal voltage regulators for the CPU. For such devices, 'upping' the 5v supply in an attempt to get more out of the CPU isn't going work (but might help with other on-board circuits)

The dsPIC range has a new core architecture, which runs at osc/1, and (it seems) is even more tolerant of overclocking ...

Specific reports of overclock by chip part number

Below all taken from actual user reports (unless specified, frequency is Fosc external clock). NOTE THAT whilst the 'low end' parts may be 'over clockable' to the higher speed 'mid end' parts, they are NOT NECESSARILY any cheaper (in fact, some 'legacy' parts eg. the -04 and -10, can be (much) more expensive)

PIC12F 617

Rated at 20MHz, will run at 24MHz (6 MIPS)

PIC12F 675

Rated at 20MHz, runs at 27 MHz (generating video signals)

PIC12F 683

Rated at 20MHz, runs fine with 25MHz Xtal (15pF caps), exit to see PicoOSD

PIC16C 66

Rated to 20MHz, runs at 33MHz

PIC16F84-04

This is the "4MHz" part that the same production silicon as the PIC16F84-10 and will usually run at 10MHz (5.0v). Thousands have been run for 3 years at 8MHz (which sugggest they 'only just failed' the 10 spec test). Most will run reliably with 12Mhz resonator/crystal

Also reported running at 15MHz, using R-C osc mode

PIC16F84A-04

This is the "4MHz" part that runs at 20MHz (i.e. it's the exact same production silicon as the PIC16F84A-20). Users report reliable drive at 25MHz, one achieved reliable operation with a crystal of 6.630059MHz (with 4x PLL) = 26.520236 MHz.

PIC16F 627(A)

Rated at 20MHz, will run at 27MHz

PIC16F 628-04, 628-20, 628(A)

By 2005, all the 628-04 rated parts were running at 20MHz (the 628-20 speed). The -04 are -20 no longer available and all 628 / 628A devices are rated at 20MHz. All run reliably at 24MHz

PIC16F 874A

Rated at 20MHz, runs at 30 MHz (one user reports 32MHz)

PIC16F 876A

Rated at 20MHz, works with "22.118MHz crystal" (assumed to mean external osc)

PIC16F 877A

Rated at 20MHz, 100% OK at 35MHz, CPU works at 40MHz (but using external osc. module, and ADC didn't work)

PIC18F 6720 & 8720 (obsolete ?)

Rated at 6.25MIPS (25 MHz internal), will run at 10MIPS (with 10MHz crystal and PLL x4 = 40MHz internal)

PIC18F 2525, 4431 and 4520

Rated at 10MIPS (10 MHz crystal, 40MHz), works with 11.0592 MHz crystal (x4 PLL, 44.2368MHz) just fine

One never-ending annoyance is the way Microchip PIC specs seem to 'almost reach' useful OSC speeds. For example, to get integer divide UART rates, you have to run with 11.0592 MHz crystal (and 4x PLL) on parts such as the PIC18F2525, PIC18F4431 and PIC18F4520 rather than the max. rated 10MHz crystal. Of course they all work (with 11.0592 MHz crystal) just fine (even at 5.0v) :-)

Whilst you can't do this in a 'commercial' design, the hobbyist can proceed with confidence and go ahead with 11.0592 MHz (with 4x PLL = 44.2368MHz). The chances of it NOT working are effectively zero (in fact, the straight 40MHz parts can be expected to reach 48MHz (12 MIPS) without problems)

PIC18F 452

Rated at 40MHz, runs OK at 48MHz (some report getting it to 60MHz, 15MIPS !)

One used a 12.288 Mhz crystal with x4 PLL = 49.152 Mhz (almost 12.5MIPS)

PIC18F 2550

overclocks to 53MHz

PIC18F 4620

Rated at 40MHz, there are claims of 'up to 80MHz' (20 MIPS), which suggests this chip is made on the '64MHz' design line

PIC18F 25K20

Rated to 64MHz = 16 MIPS, achieved 80MHz (20 MIPS)

PIC18F 26K20

Rated to 16MHz xtal (with PLLx4 = 64MHz) = 16 MIPS. Used with a 24MHz xtal (plus x4 PLL = 96MHz) for 24MIPS & it worked fine

Note on the 18F SPI Bus. This CAN be run at 16MHz, HOWEVER you have to adjust the default Slew Rate = See Data sheet DS41303E-page 136:-
"10.8 Port Slew Rate Control. The output slew rate of each port is programmable to select either the standard transition rate or a reduced transition rate of 0.1 times the standard to minimize EMI. The reduced transition time is the default slew rate for all ports."
What this MEANS is, by DEFAULT the SPI bus pins are being being driven at 10% of their actual capacity (thus significantly impacting the max. achievable frequency of the SPI Bus (10% = typ. 4MHz).

PIC 24Fxxx (mote, these are CPU = OSC/2 parts)

PIC24HJ256GP206 80MHz rated. Reports they can be overclocked at 100MHz (giving 50MIPS)

PIC32MX 120F032B

Rated at 40MHz, two out of 3 worked fine at 80 MHz (the third one limited at 72 MHz).

PIC32MX 150F128B

Rated at 40MHz, ramped speed up and found the limit at 68MHz.

dsPIC33FJ (12GP201 and 128GP306). These are CPU = OSC/1

Sometimes the PLL works for you - the external OSC/clk of the dsPIC is Spec. limited to 40MHz, however you can get 80MHz out of the internal PLL and (apparently) 'stay in spec'

Various 'dsPIC' chips have been run with an external Clk of 60 MHz (60MIPS)

Microchip device selector

See here for Microchips own PIC selector

More often, your 'PIC chip of choice' will be whatever is cheap on eBay (from China :-) ).
 
At the time of writing (Jan 2017) you could get 5x PIC12F675 for £1.54 or 5x 12F629 for £1.64 (both surface mount, 8pin), 5x 12F675 in a DIP8 package will cost you £2 (or 10x for £3.94).
 
If you want more pins, 5x 16F628 in SOP-18 will cost you £2.99 (or £3.71 in DIP18).

NOTE - you can't reply on cheap 'Chinese copy' devices being produced on a 'higher spec' production line == so don't be too surprised when you try to overclock a 20MHz rated chip and discover it fails at 20.00001 MHz :-)

Next page :- Programming the PIC

[top]