Raspberry Pi · SC0915

Raspberry Pi Pico

Raspberry Pi Pico: an RP2040 (two Cortex-M0+ cores) with 2 MB of flash.

EmbassyZephyrRaspberry Pi
Raspberry Pi PicoRaspberry Pi · RP2040 · 2 × Cortex-M0+ · 133 MHz · 264 KB · bare metalRP204012345671can0 CANCAN (an MCP2515 on SPI0) · sck PIN_18, mosiPIN_19, miso PIN_16, cs PIN_17, int PIN_202uart0 UARTUART0 · tx PIN_0, rx PIN_13usb USBMicro-USB4pwr Power5 V USB or VSYS5v3v3 Power3V3(OUT), pin 366vbus PowerVBUS, pin 40 (5 V from USB)7i2c0 I²CI2C0 (GP4, GP5) · sda PIN_4, scl PIN_51 GPIO pins, each a port (led, …)

En bref

RP2040 board: two 133 MHz Cortex-M0+ cores, 264 KB SRAM, 2 MB flash, 26 GPIOs. No CAN controller: CAN goes through an MCP2515 on SPI0 (a common add-on board).

Horloge133 MHz
Flash2 MB
RAM264 KB
GPIO26
Logique3.3 V

Caractéristiques

Lues dans le modèle de la carte, dans le store.

Processeur
RP2040 · 2× Cortex-M0+ · chip "rp2040"
Horloge
133 MHz
Flash
2 MB
RAM
264 KB
Broches GPIO
26
CAN (ADC)
ADC 3 ch 12-bit
Niveau logique
3.3 V
Alimentation
5 V USB or VSYS (in); 3V3(OUT), pin 36: 3.3 V (≤ 300 mA); VBUS, pin 40 (5 V from USB): 5 V
Courant par broche
pas encore dans le modèle de la carte
Bus
UART ×2, I²C ×2, SPI ×2, USB ×1
Tourne
sans OS (bare metal)

Brochage

Chaque broche selon ce qu’elle fait. Survolez ou touchez une broche pour voir ce qu’elle peut être d’autre.

  • Alimentation 3
  • Numérique 9
  • Analogique 2
  • Bus 15
  • PIN_0GP0
  • PIN_1GP1
  • PIN_2GP2
  • PIN_3GP3
  • PIN_4GP4
  • PIN_5GP5
  • PIN_6GP6
  • PIN_7GP7
  • PIN_8GP8
  • PIN_9GP9
  • PIN_10GP10
  • PIN_11GP11
  • PIN_12GP12
  • PIN_13GP13
  • PIN_14GP14
  • PIN_15GP15
  • PIN_16GP16
  • PIN_17GP17
  • PIN_18GP18
  • PIN_19GP19
  • PIN_20GP20
  • PIN_21GP21
  • PIN_22GP22
  • PIN_26GP26
  • PIN_27GP27
  • PIN_28GP28
  • pwr5 V USB or VSYS
  • v3v33V3(OUT), pin 36
  • vbusVBUS, pin 40 (5 V from USB)

Attention

Ce qu’archec vérifie pour cette carte, d’après ses données. Chaque point nomme la vérification qui l’attrape.

  • Ses broches travaillent en 3.3 V. La sortie d’un capteur 5 V sur l’une d’elles demande un adaptateur de niveau entre les deux.

    vérification pin-level

  • La carte utilise déjà PIN_25 (LED). Autre chose branché là entre en conflit.

    vérification pin-conflict

  • La sortie 3V3(OUT), pin 36 donne au plus 300 mA en 3.3 V. Additionnez ce que vous alimentez avec.

    vérification board-current

  • Elle donne 3.3 V (3V3(OUT), pin 36), 5 V (VBUS, pin 40 (5 V from USB)). Alimentez chaque pièce depuis une sortie à sa propre tension.

    vérification board-supply

  • Elle a 2 UART, 2 I²C, 2 SPI. Un bus de plus d’un même type est une erreur.

    vérification board-peripheral

  • Chaque bus va sur les broches qui peuvent le porter (voir le brochage). Une autre broche est une erreur.

    vérification pin-function

Premier modèle

Un clignotement pour cette carte : la carte, une LED et une partie qui l’inverse toutes les 500 ms. archec le vérifie, puis écrit le code à droite.

main.archeOuvrir dans le playground
project Blink "Blink" {
  version "0.1.0"
  edition "1.0"
  uses arche-hw-store "^0.1"
}

include "arche-hw-store/boards/raspberry-pi-pico/raspberry-pi-pico.arche"
include "arche-hw-store/devices/led/led.arche"

/// Turns the LED over at each step.
component Blinker "Blinker" {
  out led: requires Led
  fn blink "Blink" {
    ```arche
    led.toggle()
    ```
    wcet 50us
  }
}

/// The board, an LED on the board's LED (PIN_25), and the blinker.
system Hw "Blink" {
  part board:   RaspberryPiPico
  part led:     GpioLed { in pin { pins { pin PIN_25 } } }
  part blinker: Blinker
  blinker.led -> led.led
}

/// The firmware: the blinker every 500 ms.
deployment OnBoard "On the board" {
  system Hw
  platform Hw
  binary blink on board {
    thread main "Blink" { runs blinker; period 500ms; step blink }
  }
}
archec gen --target embassyblink/src/app/blinker.rs
//! Your code: the state and behaviour of this part. Write it between the USER CODE markers:
//! when the model changes, `archec gen` writes this file again around them (a new function, a
//! new input) and keeps them. Edit outside them and the file is yours: it is left as it is,
//! and the compiler says what to add (a new trait method).

#[allow(unused_imports)]
use crate::arche::*;

// @arche blinker main.arche:25 part
/// blinker
#[derive(Default)]
pub struct Blinker {}

impl BlinkerBehaviour for Blinker {
    // @arche blinker.blink main.arche:13 fn
    async fn blink(&mut self, _out: &BlinkerOut) {
        // Blink: from the model (```arche)
        _out.call_led_toggle().await;
    }
}

blink/src/app/blinker.rs, l’un des 16 fichiers qu’archec écrit.

Ouvrir dans le playground

Les pièces de la carte

Ce qu’est chaque pièce numérotée. Cliquez sur un numéro pour la trouver sur la carte.

1 2 3 4 5 6 7 8 9 10

Trouvez la pièce

Le quiz nomme une pièce : cliquez dessus sur la carte. Un premier essai réussi marque un point.

Comparer toutes les cartes