Raspberry Pi Pico C SDK Notes

14 April 2022

If you haven't read the article, I've written long time ago, I'm suggesting you to go there first.

Raspberry Pi Pico (RP2040) İlk Kullanım
> Bu yazı düzenlemeye ihtiyaç duymaktadır.Öncelikle herkese merhaba. Yakın bir zamanda Raspberry Pi Pico kartının siparişini verdim ve bugün elime ulaştı. Gerekli kurulumları ve ilk denememi sizinle de paylaşmak istedim. Ben bu yazıda ilk olarak C/++ ile bir giriş yapacağım. ARM mikrokontrolcüler…

In today's blog post, we're going to dive into the SDK documentation of the Raspbery Pi Pico, and take notes for future ourselves.

  • pico/stdlib.h is an umbrella header that pulls in some other
    commonly used headers. Some examples are as follows: hardware/gpio.h, pico/time.h.
  • The libraries inside the hardware directory has thinner abstraction and has minimum run-time costs, however, pico ones are mostly high-end libraries that have higher run-time costs.
  • One can upload any ELF file into the Pico thought SWG port. But, mostly we choose to use BOOTSEL button in the Pico which acts like flash drive in our computer. To use this functionality, we need to convert our ELF files into UF2 files. The line pico_add_extra_outputs() in the CMakeList files are used for this conversion purposes, and for getting map, hex, etc.
  • "The PIO subsystem on RP2040 allows you to write small, simple programs for what are called PIO state machines, of which RP2040 has eight split across two PIO instances. A state machine is responsible for setting and reading one or more GPIOs, buffering data to or from the processor (or RP2040’s ultra-fast DMA subsystem), and notifying the processor, via IRQ or polling, when data or attention is needed."
  • If you need to use bit-banging in any case on RP2040, just use PIOs instead.
  • All the libraries are compatible with using C++.
  • FIFOs are data queues, implemented in hardware. Each state machine has two FIFOs, between the state machine and the system bus, for data travelling out of (TX) and into (RX) the chip. Their name (first in, first out) comes from the fact that data appears at the FIFO’s output in the same order as it was presented to the FIFO’s input.