[time-nuts] PicoDIV, the RPi Pico frequency divider

Marek Dorsic marek.dorsic at gmail.com
Thu May 13 21:03:43 UTC 2021


Hello Time-Nuts,

   first time a read about the PIOs of the Raspberry Pi Pico <https://www.raspberrypi.org/blog/what-is-pio/> and saw the few PIO assembler instructions <https://www.youtube.com/watch?v=yYnQYF_Xa8g> I immediately thought about the PicDIV frequency divider of Tom van Baak.
As you may know, programming PIC is not a piece of cake when not completely impossible (e.g. for those with an MacOS or without proper PIC programmer). But every kid can plug in a USB cable and drag & drop a file. That is how RPi Pico is programmed. 

Hence I reinvented the wheel and created PicoDIV project - basic 10M : 1 frequency divider implemented within the PIO of the RPi Pico. The code configures the system clock to be driven by the impulses on GPIO20 (note that only GPIO20 and GPIO22 pins can be used for this purpose) which then clocks the PIO assembler instructions counting pulses and controlling output pins.
You can find the code at https://github.com/dorsic/PicoDIV <https://github.com/dorsic/PicoDIV>

Sadly I am not able to measure the jitter of outputting signal and cannot compare it with the original PicDIV. I would greatly appreciate if some of you will have the time and interest to do so. If any code modifications will be required, just write me a note.

For those who do not have the toolchain installed to compile own code I provide built sample. Download the picoDIV.uf2 <https://github.com/dorsic/PicoDIV/blob/main/build/picoDIV.uf2> file and drag & drop it to your Pico.
Connect 10MHz, 0-3.3V square wave signal to GPIO20 (pin 26) and you will see 1 PPS 10ms pulses on pin GPIO0 (pin 1), the onboard blinking and also 1 MHz and 100 kHz signals on GPIO21 and GPIO15 respectively.

Just be careful, all RPi Pico GPIOs are 3.3V. The Pico GPIO cannot be used at 5V.



    .md







More information about the Time-nuts_lists.febo.com mailing list