1.. _stm32f103_mini_board:
2
3STM32F103 Mini
4################
5
6Overview
7********
8
9The STM32F103_MINI board features an ARM Cortex-M3 based STM32F103RC MCU
10with a wide range of connectivity support and configurations. There are
11multiple version of this board like ``stm32f103_mini``.
12
13.. image:: img/stm32f103_mini_yellow.jpg
14   :align: center
15   :alt: STM32F103 Mini Yellow
16
17.. image:: img/stm32f103_mini_blue.jpg
18   :align: center
19   :alt: STM32F103 Mini Blue
20
21Hardware
22********
23STM32F103 Mini provides the following hardware components:
24
25- STM32 microcontroller in QFP64 package
26
27- Flexible board power supply:
28
29  - USB VBUS or external source (3.3V, 5V, 7 - 12V)
30  - Power management access point
31
32- Two LEDs:
33
34  - User LED (LD1), power LED (LD2)
35
36- USB re-enumeration capability:
37
38  - Mass storage
39
40More information about STM32F103RC can be found here:
41
42- `STM32F103 reference manual`_
43- `STM32F103 data sheet`_
44
45Supported Features
46==================
47
48The Zephyr stm32f103_mini board configuration supports the following hardware features:
49
50+-----------+------------+-------------------------------------+
51| Interface | Controller | Driver/Component                    |
52+===========+============+=====================================+
53| NVIC      | on-chip    | nested vector interrupt controller  |
54+-----------+------------+-------------------------------------+
55| UART      | on-chip    | serial port-polling;                |
56|           |            | serial port-interrupt               |
57+-----------+------------+-------------------------------------+
58| PINMUX    | on-chip    | pinmux                              |
59+-----------+------------+-------------------------------------+
60| GPIO      | on-chip    | gpio                                |
61+-----------+------------+-------------------------------------+
62| CLOCK     | on-chip    | reset and clock control             |
63+-----------+------------+-------------------------------------+
64| FLASH     | on-chip    | flash memory                        |
65+-----------+------------+-------------------------------------+
66| WATCHDOG  | on-chip    | independent watchdog                |
67+-----------+------------+-------------------------------------+
68| ADC       | on-chip    | ADC Controller                      |
69+-----------+------------+-------------------------------------+
70| PWM       | on-chip    | pwm                                 |
71+-----------+------------+-------------------------------------+
72| SPI       | on-chip    | spi                                 |
73+-----------+------------+-------------------------------------+
74| USB       | on-chip    | USB device                          |
75+-----------+------------+-------------------------------------+
76| COUNTER   | on-chip    | rtc                                 |
77+-----------+------------+-------------------------------------+
78| RTC       | on-chip    | rtc                                 |
79+-----------+------------+-------------------------------------+
80
81Other hardware features are not yet supported in this Zephyr port.
82
83The default configuration can be found in the defconfig file:
84``boards/arm/stm32f103_mini/stm32f103_mini_defconfig``
85
86Connections and IOs
87===================
88
89Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
90input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
91GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
92capable except for analog inputs.
93
94Board connectors:
95-----------------
96.. image:: img/stm32f103_mini_pin.jpg
97   :align: center
98   :alt: Nucleo F103RB connectors
99
100Default Zephyr Peripheral Mapping:
101----------------------------------
102
103- UART_1 TX/RX: PA9/PA10
104- UART_2 TX/RX: PA2/PA3 (ST-Link Virtual COM Port)
105- SPI1 NSS/SCK/MISO/MOSI: PA4/PA5/PA6/PA7
106- SPI2 NSS/SCK/MISO/MOSI: PB12/PB13/PB14/PB15
107- I2C1 SDA/SCL: PB9/PB8
108- PWM1_CH1: PA8
109- USER_PB: PC13
110- LD1: PA5
111- USB_DC DM/DP: PA11/PA12
112
113System Clock
114------------
115
116The on-board 8MHz crystal is used to produce a 72MHz system clock with PLL.
117
118Programming and Debugging
119*************************
120
121Applications for the ``stm32f103_mini`` board configuration can be built and
122flashed in the usual way (see :ref:`build_an_application` and
123:ref:`application_run` for more details).
124
125Flashing
126========
127
128There are 2 main entry points for flashing STM32F1X SoCs, one using the ROM
129bootloader, and another by using the SWD debug port (which requires additional
130hardware such as ST-Link). Flashing using the ROM bootloader requires a special activation
131pattern, which can be triggered by using the BOOT0 pin.
132
133Flashing an application to stm32f103 mini
134-----------------------------------------
135
136Here is an example for the :zephyr:code-sample:`blinky` application.
137
138.. zephyr-app-commands::
139   :zephyr-app: samples/basic/blinky
140   :board: stm32f103_mini
141   :goals: build flash
142
143You will see the LED blinking every second.
144
145Debugging
146=========
147
148You can debug an application in the usual way.  Here is an example for the
149:zephyr:code-sample:`blinky` application.
150
151.. zephyr-app-commands::
152   :zephyr-app: samples/basic/blinky
153   :board: stm32f103_mini
154   :maybe-skip-config:
155   :goals: debug
156
157References
158**********
159
160.. target-notes::
161
162.. _STM32F103 reference manual:
163   https://www.st.com/resource/en/reference_manual/cd00171190.pdf
164
165.. _STM32F103 data sheet:
166   https://www.st.com/resource/en/datasheet/stm32f103rc.pdf
167