Overclocking the Arduino DUE

Thought I try some DUE overclocking just for the fun of it :slight_smile:
So I tried some different PLL MUL/DIV settings.

It seem that 120MHz is max what the SAM3X8E Cortex M3 chip will run.
This is not because of the flash read speed but because of the internal SRAM and that has no waitstate setting.

So at 114MHz it runs stable with the original 4FWS setting (20MHz AHB bus-speed).

That is 136% overclocking without any problems.

#define SYS_BOARD_PLLAR (CKGR_PLLAR_ONE | CKGR_PLLAR_MULA(18UL) | CKGR_PLLAR_PLLACOUNT(0x3fUL) | CKGR_PLLAR_DIVA(1UL))
#define SYS_BOARD_MCKR ( PMC_MCKR_PRES_CLK_2 | PMC_MCKR_CSS_PLLA_CLK)
        
/* Set FWS according to SYS_BOARD_MCKR configuration */
EFC0->EEFC_FMR = EEFC_FMR_FWS(4); //4 waitstate flash access
EFC1->EEFC_FMR = EEFC_FMR_FWS(4);

/* Initialize PLLA to 114MHz */
PMC->CKGR_PLLAR = SYS_BOARD_PLLAR;
while (!(PMC->PMC_SR & PMC_SR_LOCKA)) {}

PMC->PMC_MCKR = SYS_BOARD_MCKR;
while (!(PMC->PMC_SR & PMC_SR_MCKRDY)) {}

Thanks for sharing this valuable information. It's interesting to see that you can reduce power consumption down to 20% by lowering the processor clock speed to some MHz. This can be very interesting for low power battery-operated devices as you can recover the full processor speed in some microseconds... Additionally, disabling all unused peripherals can lead to even lower power consumption and greater battery life without losing any functionality.

can this be used on a UNO too or is it not possible ?

No not the same as UNO and DUE are completely different processors.

That said, there have been many overclocked UNO's google is your friend)

Saving power with an UNO is well described here - http://www.gammon.com.au/forum/?id=11497

I want to set my Due to 96 Mhz (I hope it will be still programmable from the arduino environment after I set it to 96Mhz). How do I set it to 96Mhz using the PLL?Please let me know

Awesome find! Didn't know it was overclockable to that degree -- or overclockable in the first place!
If the Due can be so easily overclocked, what about the Zero?
Also, can it be programmed when overclocked?

The UART is probably going to be off if you overclock. So is the USB.

I want to set my Due to 96 Mhz (I hope it will be still programmable from the arduino environment after I set it to 96Mhz). How do I set it to 96Mhz using the PLL?

Use this (change from 18UL for 114MHz to 15UL for 96MHz, 84MHz is 13UL or 0x0dUL (as in system_sam3xa.c):

void setup() {
#define SYS_BOARD_PLLAR (CKGR_PLLAR_ONE | CKGR_PLLAR_MULA(15UL) | CKGR_PLLAR_PLLACOUNT(0x3fUL) | CKGR_PLLAR_DIVA(1UL))
#define SYS_BOARD_MCKR ( PMC_MCKR_PRES_CLK_2 | PMC_MCKR_CSS_PLLA_CLK)
        
/* Set FWS according to SYS_BOARD_MCKR configuration */
EFC0->EEFC_FMR = EEFC_FMR_FWS(4); //4 waitstate flash access
EFC1->EEFC_FMR = EEFC_FMR_FWS(4);

/* Initialize PLLA to (15+1)*6=96MHz */
PMC->CKGR_PLLAR = SYS_BOARD_PLLAR;
while (!(PMC->PMC_SR & PMC_SR_LOCKA)) {}

PMC->PMC_MCKR = SYS_BOARD_MCKR;
while (!(PMC->PMC_SR & PMC_SR_MCKRDY)) {}  
  
// your other setup code goes here
}

MULA settings is specified here [factor is (MULA+1)]:
http://www.atmel.com/images/atmel-11057-32-bit-cortex-m3-microcontroller-sam3x-sam3a_datasheet.pdf#page=549

I did measure 20 blinks of Blink example with stop watch in 34.98s.
20 blinks take 40s normally, and 35==40*84/96

Btw, Graham showed in this posting how to fix Serial communication when running on 114MHz.

Is it possible for the Overclocked clock to be made available to PWM and timer peripherals to run them at 100MHz?

What PWM frequency and duty cycle would you need ?

FYI, with PMC_PCKx registers, you can output square signales up to 240 MHz ( see page 529, Sam3x datasheet).