Coder Social home page Coder Social logo

pico-overclock's Introduction

pico-overclock

This is a small example of overclocking a Raspberry Pi Pico. I wanted to check that the overclock was working and that my assumptions were correct.

The code contains a loop which pauses for 20 NOP instructions, the raises a GPIO, then pauses 20 more NOPs, then lowers the GPIO, then jumps back to repeat. It compiles to this:

200001ac:	46c0      	nop			; (mov r8, r8)
200001ae:	46c0      	nop			; (mov r8, r8)
200001b0:	46c0      	nop			; (mov r8, r8)
200001b2:	46c0      	nop			; (mov r8, r8)
200001b4:	46c0      	nop			; (mov r8, r8)
200001b6:	46c0      	nop			; (mov r8, r8)
200001b8:	46c0      	nop			; (mov r8, r8)
200001ba:	46c0      	nop			; (mov r8, r8)
200001bc:	46c0      	nop			; (mov r8, r8)
200001be:	46c0      	nop			; (mov r8, r8)
200001c0:	46c0      	nop			; (mov r8, r8)
200001c2:	46c0      	nop			; (mov r8, r8)
200001c4:	46c0      	nop			; (mov r8, r8)
200001c6:	46c0      	nop			; (mov r8, r8)
200001c8:	46c0      	nop			; (mov r8, r8)
200001ca:	46c0      	nop			; (mov r8, r8)
200001cc:	46c0      	nop			; (mov r8, r8)
200001ce:	46c0      	nop			; (mov r8, r8)
200001d0:	46c0      	nop			; (mov r8, r8)
200001d2:	46c0      	nop			; (mov r8, r8)
200001d4:	6162      	str	r2, [r4, #20]
200001d6:	46c0      	nop			; (mov r8, r8)
200001d8:	46c0      	nop			; (mov r8, r8)
200001da:	46c0      	nop			; (mov r8, r8)
200001dc:	46c0      	nop			; (mov r8, r8)
200001de:	46c0      	nop			; (mov r8, r8)
200001e0:	46c0      	nop			; (mov r8, r8)
200001e2:	46c0      	nop			; (mov r8, r8)
200001e4:	46c0      	nop			; (mov r8, r8)
200001e6:	46c0      	nop			; (mov r8, r8)
200001e8:	46c0      	nop			; (mov r8, r8)
200001ea:	46c0      	nop			; (mov r8, r8)
200001ec:	46c0      	nop			; (mov r8, r8)
200001ee:	46c0      	nop			; (mov r8, r8)
200001f0:	46c0      	nop			; (mov r8, r8)
200001f2:	46c0      	nop			; (mov r8, r8)
200001f4:	46c0      	nop			; (mov r8, r8)
200001f6:	46c0      	nop			; (mov r8, r8)
200001f8:	46c0      	nop			; (mov r8, r8)
200001fa:	46c0      	nop			; (mov r8, r8)
200001fc:	46c0      	nop			; (mov r8, r8)
200001fe:	61a2      	str	r2, [r4, #24]
20000200:	e7d4      	b.n	200001ac <main+0x50>

That's 44 machine cycles per iteration, and the GPIO can be seen on a 'scope toggling at a constant frequency.

Here's a 'scope image from a Pico running at the standard 135MHz:

135MHz

Content ns per cycle Cycles Total Cycles
40 NOPs 7.4074 40 296.296
2 GPIOs 7.4074 2 14.8148
Branch 7.4074 2 14.8148

325.9256ns, 'scope says 326.0ns

...and at 200MHz:

200MHz

Content ns per cycle Cycles Total Cycles
40 NOPs 5.0000 40 200.000
2 GPIOs 5.0000 2 10.0000
Branch 5.0000 2 10.0000

220.0000ns, 'scope says 219.6ns

...and at 270MHz:

270MHz

Content ns per cycle Cycles Total Cycles
40 NOPs 3.7037 40 148.148
2 GPIOs 3.7037 2 7.4074
Branch 3.7037 2 7.4074

162.9628ns, 'scope says 163.2ns

...and at 360MHz:

360MHz

Content ns per cycle Cycles Total Cycles
40 NOPs 2.7777 40 111.108
2 GPIOs 2.7777 2 5.5554
Branch 2.7777 2 5.5554

122.2188ns, 'scope says 122.0ns

So the overclocking appears to work and the timings are as expected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.