1.. _stm32_min_dev: 2 3STM32 Minimum Development Board 4############################### 5 6Overview 7******** 8 9The STM32 Minimum Development Board, is a popular and inexpensive 10breadboard-friendly breakout board for the `STM32F103x8`_ CPU. There 11are two variants of the board: 12 13- Blue Pill Board 14- Black Pill Board 15 16Zephyr applications can use the stm32_min_dev_blue or stm32_min_dev_black board 17configuration to use these boards. 18 19.. figure:: img/stm32_min_dev.jpg 20 :align: center 21 :alt: STM32 Minimum Development Board 22 23 STM32 Minimum Development Board 24 25As the name suggests, these boards have the bare minimum components required to 26power on the CPU. For practical use, you'll need to add additional components 27and circuits using a breadboard, for example. 28 29Pin Mapping 30=========== 31 32This port is a starting point for your own customizations and not a complete 33port for a specific board. Most of the GPIOs on the STM32 SoC has been exposed 34in the external header with silk screen labels that match the SoC's pin names. 35 36Each board vendor has their own variations in pin mapping on their boards' 37external connectors and placement of components. Many vendors use port PC13/PB12 38for connecting an LED, so only this device is supported by our Zephyr port. 39Additional device support is left for the user to implement. 40 41More information on hooking up peripherals and lengthy how to articles can be 42found at `EmbedJournal`_. 43 44The pinout diagram of STM32 Minimum Development Blue Pill board can be seen 45below. The Black Pill's one is similar: 46 47.. figure:: img/stm32_min_dev_pinout_blue.jpg 48 :align: center 49 :alt: Pinout for STM32 Minimum Development Blue Pill Board 50 51 Pinout for STM32 Minimum Development Blue Pill Board 52 53 54STLinkV2 connection: 55==================== 56 57The board can be flashed by using STLinkV2 with the following connections. 58 59+--------+---------------+ 60| Pin | STLINKv2 | 61+========+===============+ 62| G | GND | 63+--------+---------------+ 64| CLK | Clock | 65+--------+---------------+ 66| IO | SW IO | 67+--------+---------------+ 68| V3 | VCC | 69+--------+---------------+ 70 71Boot Configuration 72================== 73 74The boot configuration for this board is configured through jumpers on B0 (Boot 0) 75and B1 (Boot 1). The pins B0 and B1 are present in between logic 0 and 1 lines. The 76silk screen on the PCB reads BX- or BX+ to indicate 0 and 1 logic lines for B0 and B1 77respectively. 78 79+--------+--------+-------------------+---------------------------------------------+ 80| Boot 1 | Boot 0 | Boot Mode | Aliasing | 81+========+========+===================+=============================================+ 82| X | 0 | Main Flash Memory | Main flash memory is selected as boot space | 83+--------+--------+-------------------+---------------------------------------------+ 84| 0 | 1 | System Memory | System memory is selected as boot space | 85+--------+--------+-------------------+---------------------------------------------+ 86| 1 | 1 | Embedded SRAM | Embedded SRAM is selected as boot space | 87+--------+--------+-------------------+---------------------------------------------+ 88 89 90Supported Features 91================== 92 93The stm32_min_dev board configuration supports the following hardware features: 94 95+-----------+------------+----------------------+ 96| Interface | Controller | Driver/Component | 97+===========+============+======================+ 98| NVIC | on-chip | nested vectored | 99| | | interrupt controller | 100+-----------+------------+----------------------+ 101| SYSTICK | on-chip | system clock | 102+-----------+------------+----------------------+ 103| UART | on-chip | serial port | 104+-----------+------------+----------------------+ 105| GPIO | on-chip | gpio | 106+-----------+------------+----------------------+ 107| I2C | on-chip | i2c | 108+-----------+------------+----------------------+ 109| PWM | on-chip | pwm | 110+-----------+------------+----------------------+ 111| SPI | on-chip | spi | 112+-----------+------------+----------------------+ 113| USB | on-chip | USB device | 114+-----------+------------+----------------------+ 115| ADC | on-chip | adc | 116+-----------+------------+----------------------+ 117 118Other hardware features have not been enabled yet for this board. 119 120Connections and IOs 121=================== 122 123Default Zephyr Peripheral Mapping: 124---------------------------------- 125 126- UART_1 TX/RX: PA9/PA10 127- UART_2 TX/RX: PA2/PA3 128- UART_3 TX/RX: PB10/PB11 129- I2C_1 SCL/SDA : PB6/PB7 130- I2C_2 SCL/SDA : PB10/PB11 131- PWM_1_CH1: PA8 132- SPI_1 NSS_OE/SCK/MISO/MOSI: PA4/PA5/PA6/PA7 133- SPI_2 NSS_OE/SCK/MISO/MOSI: PB12/PB13/PB14/PB15 134- USB_DC DM/DP: PA11/PA12 135- ADC_1: PA0 136 137System Clock 138------------ 139 140The on-board 8Mhz crystal is used to produce a 72Mhz system clock with PLL. 141 142Serial Port 143----------- 144 145STM32 Minimum Development Board has 3 U(S)ARTs. The Zephyr console output is 146assigned to UART_1. Default settings are 115200 8N1. 147 148On-Board LEDs 149------------- 150 151The board has one on-board LED that is connected to PB12/PC13 on the black/blue 152variants respectively. 153 154Programming and Debugging 155************************* 156 157Applications for the ``stm32_min_dev_(blue|black)`` board configuration can be 158built and flashed in the usual way (see :ref:`build_an_application` and 159:ref:`application_run` for more details). 160 161Flashing 162======== 163 164Here is an example for the :zephyr:code-sample:`blinky` application. 165 166.. zephyr-app-commands:: 167 :zephyr-app: samples/basic/blinky 168 :board: stm32_min_dev_blue 169 :goals: build flash 170 171Debugging 172========= 173 174You can debug an application in the usual way. Here is an example for the 175:ref:`hello_world` application. 176 177.. zephyr-app-commands:: 178 :zephyr-app: samples/hello_world 179 :board: stm32_min_dev_blue 180 :maybe-skip-config: 181 :goals: debug 182 183.. _STM32F103x8: 184 https://www.st.com/resource/en/datasheet/stm32f103c8.pdf 185.. _EmbedJournal: 186 https://embedjournal.com/tag/stm32-min-dev/ 187