Clock frequency

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
nath_pyboard
Posts: 1
Joined: Tue Apr 28, 2015 11:27 pm

Clock frequency

Post by nath_pyboard » Tue Apr 28, 2015 11:34 pm

Hi,

I have recently obtained the pyboard v1.0 and the default system frequency is set to 168 MHz (I have also set the freq. to 120 MHz in boot.py). However, when testing the frequency by setting an LED on and off repeatedly, I only read approx. 33 kHz.

Is there something I have missed or am over-looking? I am trying to test how fast python files can run on this board.

Cheers
Nathan

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Clock frequency

Post by pythoncoder » Wed Apr 29, 2015 7:28 am

Python is an interpreted language and therefore runs much slower than the processor clock. However you should see rates nearer 100KHz: see this reference which also shows techniques for speeding it up further https://www.kickstarter.com/projects/21 ... sts/664832
You can speed it up to a stupendous degree by using the inline assembler, but this requires some knowledge of the ARM architecture and of assembly language programming. http://docs.micropython.org/en/latest/t ... mbler.html. Read the Wiki also if you want to use this technique as the assembler is not yet officially fully documented.
Peter Hinch
Index to my micropython libraries.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Clock frequency

Post by Damien » Wed Apr 29, 2015 8:26 am

The high clock speed allows the peripherals to run fast as well. Eg you can get close to 1MHz ADC conversion into a buffer using ADC.read_timed. You can also use the timers to get high speed changes on pins.

Post Reply