RP2040 - System Clocks - Bare Metal Programming - BMA05 - ndbatteries.com

RP2040 – System Clocks – Bare Metal Programming – BMA05

Life with David
Views: 465
Like: 58
RP2040 – System Clocks – Bare Metal Programming – BMA05

Join David as he dives into the bare metal programming aspects for setting up the clocks for the RP2040. He looks at the ring oscillator, the crystal oscillator, phase locked loops, and utilizing external clocks. He also demonstrate how to output a clock from the RP2040 for use in other circuits.

Resources for this Chapter::

Demonstration files for this video:

Link to “Bare Metal Adventures, Chapter 01”:

Link to “Bare Metal Adventures, Chapter 04”:

Cortex-M0+ Generic User Guide:

ARMv6-M Architecture Reference Manual:

RP2040 Datasheet:

Getting Started with the Raspberry Pi Pico:


ARM Assembly Language Tutorial:

00:00 – Introduction
00:51 – RP2040 Clock overview
01:31 – Ring Oscillator
02:20 – Demo 1: Ring Oscillator right after boot
03:34 – Demo 2: Ring Oscillator increased speed
06:11 – Demo 3: Ring Oscillator increased stage power
07:37 – Demo 4: Crystal Oscillator at base speed of 12 MHz
14:13 – Demo 4A: Outputting the reference clock to GPIO
15:45 – Demo 5: PLL at 125 MHz
18:45 – Demo 6: Using external clocks
21:27 – Closing

(Pinnacle 25 royalty-free music):
Pulsing Dance
House Fever
Reaction Time
City Night Groove

Clip credit:
Start Trek II: The Wrath of Kahn
Paramount Pictures


  1. These videos are absolutely brilliant!! Thank you. I hope I can contribute something to the collective expertise around here some time. …

  2. Thank you very much – as i who comes from the ATSAM4S Assembly programming its quite a difference. But i´m somewhere stuck in terms of the XOSC, because the PLL dosn´t work as expected.Steps:- Resetting the PLL block at 0x4000f000 on Bit 12- Checking on 0x4000c008 if the Pll has been reset- put #125 on offse t0x40028008 and 0x62 shifted by 12 into 0x4002800c- put 0x21 into 0x40028004 (PLL power down)- wating for PLL lock 0x40028000 Bit 31=>never leaving I´m quite stuck. What could be the issue?Edit: My fault. I was using the PLL Powerdown Register 0x40028004 instead of the Atomic Register at 0x4002b000, because at first i didn´t see you´re providing the sourcecode (in the video description) – and as i couldn´t figure out where pll_sys_aclr refers to, i´ve used the Powerdown register 🙁 Is there a reference in the Handbook to those atomic registers? Thank you!Well, things were not that hard at times of the good ol´ 8051 and AVRs….compared to them, i´m still wondering why the ARM-Peripherals have to be so complicated to use and why each manufacturer has different structures regarding the peripherals…at least once again thanks for your work, which is a great help for a strict non-C++-Programmer! If i could recommand an additional channel to yours, consider to have a look at CuriousMarc. He does "bare metal" on hardware level 🙂

  3. Excellent work, David! There are quite a few moving parts to setting the clock, so I'm glad you were able to explain it.

  4. Just curious, where was the amusement park at the end of the presentation? Any place like Cedar Point?

  5. David, the PIO series was interesting. Please dive deeper, with more use cases.
    One implementation would be to read the rpm of a motor and use the reading as input to a PID. I can give you what I have done, it could be improved.

  6. I like the way you pronounce the hex number correctly. So many kids seem to be very lax with numbers , I hear thing like 'ten hex' or 'one thousand binary ' . Don't get me started on decimals…… 'one point hundred twenty ' arrrrggghh

  7. Very nice! Again, David is not just scratching the surface!

  8. Great, looking forward seen you add PIO support with Assembly.

Leave a Reply

Your email address will not be published.