Close
0%
0%

Raspberry Pi Pico and RP2040 - The Deep Dive

ARM Assembly, PIO, and System Architecture - An intense Microcontroller Internals Course

Instructors uri-shakedUri Shaked
Wednesday, May 5, 2021 02:00 pm EDT - Wednesday, June 2, 2021 02:00 pm EDT Local time zone:
Similar projects worth following

The live session of this course has ended but stay tuned for online videos!

About the Instructor

Uri is a maker who loves voiding warranties; Currently building RP2040js, an open source Raspberry Pi Pico emulator in JavaScript, and working on Wokwi, an online Arduino simulation platform. Uri also instructed the AVR internals course in the previous session of HackadayU.

Course Overview

The Raspberry Pi Pico is a capable 4$ microcontroller board. It comes with a set of features that make it a great choice for many maker projects, including the programmable I/O (PIO), which makes it possible to support new protocols and implement custom peripherals.

This course will take you on a journey to explore the internals of the RP2040 chip, the brains of the Pico. We'll learn about the system architecture, hardware peripheral registers, and even the basics of the ARM assembly language.

The course will be intense and will walk you through the core principles behind the RP2040 chip. While we can't cover everything in a 5 hours course, you'll get the essential knowledge and links to resources that will help you keep rolling on your own. Expect to spend some time digging into the microcontroller's datasheet! 📚

Prerequisites / Resources

  • Bitwise Math (and for the visual learners, also Bitwise GIFs)
  • Fluency with Arduino / microcontroller programming. I.e. being familiar with terms such as GPIO, SPI, I2C, etc.
  • Basic understanding of electronics (e.g. you should know how to use a breadboard, what an LED is and how to properly wire to a microcontroller, etc).

Software Requirements

Modern web browser (Chrome, Firefox, etc.). We'll use the online simulator at https://wokwi.com.

Optional: If you want to build the code on your machine then install the Pico SDK and get a fresh copy of pico-examples. You can find the installation instructions in Chapter 2 of the Getting Started Guide.

Hardware Requirements (optional):

The hardware is optional. We'll use the emulator during the course. But if you want to try things on the actual hardware (because it's always more fun!), here's what you need:

  • A Raspberry Pi Pico board.
  • For debugging over SWD with GDB: either a second Pi Pico or a Raspberry Pi 3 / 4. You'll also need  dupont wires and the ability to solder. Consult sections 5, 6, and Appendix A of the Getting Started Guide.

Syllabus

Class 1 - The Big Picture

We'll learn how the memory space is organized, explore the RP2040 bus fabric, become friends with the RP2040 datasheet, talk about the AHB-Lite bus and the APB bridge, and see how our C code can interact with the on-chip peripherals (such as GPIO and UART) by directly accessing the hardware registers.

Class 2 - Interrupts & Introduction to ARM Assembly

We'll cover hardware and software interrupts, the NVIC (Nested Vector Interrupt Controller), and the vector table, and of course - get our hands dirty writing some C code to demonstrate these concepts. Then we'll learn about the CPU registers, and start digging into ARM assembly.

Class 3 - Spiralling deeper

We'll continue exploring the ARM Cortex M0+ instruction set, learning about branches, flags, conditional instructions. We will also learn about the ARM assembly ABI (application binary interface) as we write our own routines in pure ARM assembly! 

Class 4 - Under the hood with GDB

We'll learn how to use GDB, the GNU Debugger, and see how we can harness its power for debugging and reverse engineering. We'll also dig into the internals of MicroPython and see how to combine it with Thumb assembly!

Class 5 - Hello, PIO

The Programmable Input/Output (PIO) is a unique feature of the RP2040 chip. It enables the creation of additional hardware interfaces, even ones that are not natively supported by the chip (WS2812B, I'm looking at you!). We'll learn how the PIO state machine works and see an example of programming it.


Final Project - Pi Pico PAL TV Pong

The deadline...

Read more »

getting_started_with_pico.pdf

Adobe Portable Document Format - 36.28 MB - 04/03/2021 at 19:57

Preview

rp2040_datasheet.pdf

Adobe Portable Document Format - 29.77 MB - 04/03/2021 at 19:57

Preview

  • Class 1

    Lutetium05/06/2021 at 17:22 0 comments

    Class 1 - The Big Picture

    We'll learn how the memory space is organized, explore the RP2040 bus fabric, become friends with the RP2040 datasheet, talk about the AHB-Lite bus and the APB bridge, and see how our C code can interact with the on-chip peripherals (such as GPIO and UART) by directly accessing the hardware registers.

    Class 1 Video:

  • Class 2

    Lutetium05/06/2021 at 17:23 0 comments

    Class 2 - Interrupts & Introduction to ARM Assembly

    We'll cover hardware and software interrupts, the NVIC (Nested Vector Interrupt Controller), and the vector table, and of course - get our hands dirty writing some C code to demonstrate these concepts. Then we'll learn about the CPU registers, and start digging into ARM assembly.

    Class 2 Video:

  • Class 3

    Lutetium05/06/2021 at 17:24 0 comments

    Class 3 - Under the hood

    We'll continue exploring the ARM Cortex M0+ instruction set, learning about branches, flags, conditional instructions. We will also learn about the ARM assembly ABI (application binary interface) as we write our own routines in pure ARM assembly, and take a look under to hood to see the assembly code generated by the GCC compiler.

    Class 3 Video: 

  • Class 4

    Lutetium05/06/2021 at 17:24 0 comments

    Class 4 - Under the hood with GDB

    We'll learn how to use GDB, the GNU Debugger, and see how we can harness its power for debugging and reverse engineering. We'll also dig into the internals of MicroPython and see how to combine it with Thumb assembly!

    Class 4 Video:

  • Class 5

    Lutetium05/06/2021 at 17:25 0 comments

    Class 5 - Hello, PIO

    The Programmable Input/Output (PIO) is a unique feature of the RP2040 chip. It enables the creation of additional hardware interfaces, even ones that are not natively supported by the chip (WS2812B, I'm looking at you!). We'll learn how the PIO state machine works and see an example of programming it.


    Class 5 Video:

View all 5 course classes

Enjoy this course?

Share

Discussions

David081988wise wrote 04/17/2024 at 06:37 point

Thanks for sharing this amazing course. 


https://www.dognearme.co.uk/

  Are you sure? yes | no

Bartlesensontravis012 wrote 05/24/2022 at 15:15 point

Really impressive course. Being the owner of  https://paintballfire.com/best-paintball-guns-under-200/ it was quite difficult for me to manage the time for watching and reading this course content. But when I started and watched the first video than I can't control myself from completing it.

  Are you sure? yes | no

JamesTown wrote 10/28/2021 at 02:46 point

Wow cool project going to play when I'm home thanks Uri.

  Are you sure? yes | no

rjkuenzi wrote 05/26/2021 at 18:47 point

How do I get link to Uri's google doc for class ?  I purchased a ticket

  Are you sure? yes | no

Lutetium wrote 05/27/2021 at 18:00 point

Here's the link: https://link.wokwi.com/pi-pico-class

  Are you sure? yes | no

Does this project spark your interest?

Become a member to follow this project and never miss any updates