STM32F103C8T6 Blue Pill

STM32 Blue Pill

The "Blue Pill": an STM32F103C8 (Cortex-M3, 72 MHz) on a breadboard stick, with a micro-USB connector, an SWD header and the BOOT0 and BOOT1 jumpers.

EmbassyDatasheet
STM32 Blue PillSTM32F103C8 · Cortex-M3 · 72 MHz · 20 KB · bare metalSTM32F103C812345678910111can0 CANbxCAN, remapped to PB8/PB9 (add a transceiver)· tx PB9, rx PB82usb USBMicro-USB (PA11, PA12)3swd jtagSWD header (SWDIO PA13, SWCLK PA14)4pwr Power5 V USB, or 3.3 V on a 3.3 pin5v3v3 Power3.3 pins (the board's regulator)6v5 Power5V pin (from USB)7gnd PowerGND8uart1 UARTUSART1 (A9, A10) · tx PA9, rx PA109uart2 UARTUSART2 (A2, A3) · tx PA2, rx PA310i2c1 I²CI2C1 (B7, B6) · sda PB7, scl PB611spi1 SPISPI1 (A5, A7, A6, A4) · sck PA5, mosi PA7, misoPA6, cs PA433 GPIO pins, each a port (led, …)

En bref

A cheap STM32 stick: an STM32F103C8 (one 72 MHz Cortex-M3), 64 KB flash, 20 KB SRAM, 3.3 V pins (most take 5 V). Program it through SWD (an ST-LINK). bxCAN on PB8/PB9 needs a transceiver.

Horloge72 MHz
Flash64 KB
RAM20 KB
GPIO33
Logique3.3 V

Caractéristiques

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

Processeur
STM32F103C8 · 1× Cortex-M3 · chip "stm32f103c8"
Horloge
72 MHz
Flash
64 KB
RAM
20 KB
Broches GPIO
33
CAN (ADC)
ADC1 10 ch 12-bit, ADC2 10 ch 12-bit
Niveau logique
3.3 V
Alimentation
5 V USB, or 3.3 V on a 3.3 pin (in); 3.3 pins (the board's regulator): 3.3 V (≤ 150 mA); 5V pin (from USB): 5 V (≤ 500 mA)
Courant par broche
20 mA
Bus
UART ×3, I²C ×2, SPI ×2, CAN ×1, 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
  • Masse 1
  • Numérique 12
  • Analogique 2
  • Bus 16
  • Contrôle 5
  • PA0A0
  • PA1A1
  • PA2A2
  • PA3A3
  • PA4A4
  • PA5A5
  • PA6A6
  • PA7A7
  • PA8A8
  • PA9A9
  • PA10A10
  • PA11A11
  • PA12A12
  • PA15A15
  • PB0B0
  • PB1B1
  • PB3B3
  • PB4B4
  • PB5B5
  • PB6B6
  • PB7B7
  • PB8B8
  • PB9B9
  • PB10B10
  • PB11B11
  • PB12B12
  • PB13B13
  • PB14B14
  • PB15B15
  • PC13C13 (LED)
  • PC14C14
  • PC15C15
  • PA13PA13
  • PA14PA14
  • PB2PB2
  • pwr5 V USB, or 3.3 V on a 3.3 pin
  • v3v33.3 pins (the board's regulator)
  • v55V pin (from USB)
  • gndGND

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

  • Une broche donne au plus 20 mA. Une LED demande une résistance ; un moteur ou un relais, un driver.

    vérification pin-current

  • Deux connecteurs de la carte partagent ces broches : PB9 (bxCAN, remapped to PB8/PB9 (add a transceiver) / B9), PB8 (bxCAN, remapped to PB8/PB9 (add a transceiver) / B8), PC13 (LED (PC13, on when low) / C13 (LED)), PA9 (USART1 (A9, A10) / A9), PA10 (USART1 (A9, A10) / A10), PA2 (USART2 (A2, A3) / A2), PA3 (USART2 (A2, A3) / A3), PB7 (I2C1 (B7, B6) / B7), PB6 (I2C1 (B7, B6) / B6), PA5 (SPI1 (A5, A7, A6, A4) / A5), PA7 (SPI1 (A5, A7, A6, A4) / A7), PA6 (SPI1 (A5, A7, A6, A4) / A6), PA4 (SPI1 (A5, A7, A6, A4) / A4). Utilisez l’un ou l’autre.

    vérification pin-conflict

  • La carte utilise déjà PC13 (LED (PC13, on when low)), PA0 (A0), PA1 (A1), PA2 (A2), PA3 (A3), PA4 (A4), PA5 (A5), PA6 (A6), PA7 (A7), PA8 (A8), PA9 (A9), PA10 (A10), PA11 (A11), PA12 (A12), PA15 (A15), PB0 (B0), PB1 (B1), PB3 (B3), PB4 (B4), PB5 (B5), PB6 (B6), PB7 (B7), PB8 (B8), PB9 (B9), PB10 (B10), PB11 (B11), PB12 (B12), PB13 (B13), PB14 (B14), PB15 (B15), PC13 (C13 (LED)), PC14 (C14), PC15 (C15). Autre chose branché là entre en conflit.

    vérification pin-conflict

  • La sortie 3.3 pins (the board's regulator) donne au plus 150 mA en 3.3 V. Additionnez ce que vous alimentez avec.

    vérification board-current

  • La sortie 5V pin (from USB) donne au plus 500 mA en 5 V. Additionnez ce que vous alimentez avec.

    vérification board-current

  • Elle donne 3.3 V (3.3 pins (the board's regulator)), 5 V (5V pin (from USB)). Alimentez chaque pièce depuis une sortie à sa propre tension.

    vérification board-supply

  • Elle a 3 UART, 2 I²C, 2 SPI, 1 CAN. 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/stm32-bluepill/stm32-bluepill.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 (PC13, on when low) (PC13), and the blinker.
system Hw "Blink" {
  part board:   Stm32BluePill
  part led:     GpioLed { in pin { pins { pin PC13 } } }
  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 14 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 11 12

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