1.. zephyr:board:: olimex_stm32_h103
2
3Overview
4********
5
6The OLIMEX-STM32-H103 is a simple development board based on the
7STMicroelectronics STM32F103RBT6 ARM Cortex-M3 CPU, with all the MCU pins
8populated and accessible through two male 26-pin connectors.
9
10Hardware
11********
12
13Information about the board can be found at the
14`OLIMEX-STM32-H103 website`_ and `OLIMEX-STM32-H103 user manual`_.
15The `OLIMEX-STM32-H103 schematic`_ is also available.
16
17The `ST STM32F103RB Datasheet`_ contains the processor's
18information and the datasheet.
19
20Supported Features
21==================
22
23.. zephyr:board-supported-hw::
24
25Connections and IOs
26===================
27
28System Clock
29------------
30
31The on-board 8 MHz crystal is used to produce a 72 MHz system clock with PLL.
32
33Zephyr Console
34--------------
35
36UART2 is used as Zephyr's console. Default settings are 115200 8N1.
37
38On-Board LEDs
39-------------
40
41The board has one on-board green LED that is connected to PC12, which
42is active low.
43
44There is also a red power LED neither connected nor controlled by the MCU.
45
46On-Board Button
47---------------
48
49The board has one user button connected to PA0.
50
51USB
52---
53
54USB is not enabled by default.
55
56PC4 can be configured as a GPIO input to detect power on the USB port. It is
57possible to disconnect it by desoldering the appropriate pad in the PCB.
58
59PC11 can be used to disconnect the pull-up resistor on the USB-DP line by
60setting it high.
61
62External Connectors
63-------------------
64
65JTAG/SWD debug
66
67+-------+----------------------+-------+--------------+
68| PIN # | Signal Name          | PIN # | Signal Name  |
69+=======+======================+=======+==============+
70| 1     | TVCC +3.3V           | 2     | TVCC 3.3V    |
71+-------+----------------------+-------+--------------+
72| 3     | PB4 / TRST           | 4     | GND          |
73+-------+----------------------+-------+--------------+
74| 5     | PA15 / TDI           | 6     | GND          |
75+-------+----------------------+-------+--------------+
76| 7     | PA13 / TMS / SWDIO   | 8     | GND          |
77+-------+----------------------+-------+--------------+
78| 9     | PA14 / TCK / SWCLK   | 10    | GND          |
79+-------+----------------------+-------+--------------+
80| 11    | NC                   | 12    | GND          |
81+-------+----------------------+-------+--------------+
82| 13    | PB3 / TDO            | 14    | GND          |
83+-------+----------------------+-------+--------------+
84| 15    | RST                  | 16    | GND          |
85+-------+----------------------+-------+--------------+
86| 17    | NC                   | 18    | GND          |
87+-------+----------------------+-------+--------------+
88| 19    | NC                   | 20    | GND          |
89+-------+----------------------+-------+--------------+
90
91EXTENSION 1
92
93+-------+-----------------------+-------+-----------------------+
94| PIN # | Name / STM32F103 Port | PIN # | Name / STM32F103 Port |
95+=======+=======================+=======+=======================+
96| 1     | PA11 / **USB_DM**     | 2     | PA8                   |
97+-------+-----------------------+-------+-----------------------+
98| 3     | PA12 / **USB_DP**     | 4     | PA9                   |
99+-------+-----------------------+-------+-----------------------+
100| 5     | +3.3V                 | 6     | GND                   |
101+-------+-----------------------+-------+-----------------------+
102| 7     | PA10                  | 8     | PC10                  |
103+-------+-----------------------+-------+-----------------------+
104| 9     | PC11 / **USB_DISC**   | 10    | PC12 / **LED**        |
105+-------+-----------------------+-------+-----------------------+
106| 11    | PD2                   | 12    | PB5                   |
107+-------+-----------------------+-------+-----------------------+
108| 13    | PB6                   | 14    | PA6                   |
109+-------+-----------------------+-------+-----------------------+
110| 15    | PB7                   | 16    | PB8                   |
111+-------+-----------------------+-------+-----------------------+
112| 17    | PB9                   | 18    | PA5                   |
113+-------+-----------------------+-------+-----------------------+
114| 19    | PC0                   | 20    | PC1                   |
115+-------+-----------------------+-------+-----------------------+
116| 21    | PB0                   | 22    | PA7                   |
117+-------+-----------------------+-------+-----------------------+
118| 23    | VBAT                  | 24    | PC13                  |
119+-------+-----------------------+-------+-----------------------+
120| 25    | RST                   | 26    | PB1                   |
121+-------+-----------------------+-------+-----------------------+
122
123EXTENSION 2
124
125+-------+------------------------+-------+-----------------------+
126| PIN # | Name / STM32F103 Port  | PIN # | Name / STM32F103 Port |
127+=======+========================+=======+=======================+
128| 1     | VDDA                   | 2     | PC2                   |
129+-------+------------------------+-------+-----------------------+
130| 3     | GNDA                   | 4     | PA0 / **BUTTON**      |
131+-------+------------------------+-------+-----------------------+
132| 5     | +3.3V                  | 6     | GND                   |
133+-------+------------------------+-------+-----------------------+
134| 7     | PA2 / **USART2_TX**    | 8     | PA1                   |
135+-------+------------------------+-------+-----------------------+
136| 9     | PC3                    | 10    | PA3 / **USART2_RX**   |
137+-------+------------------------+-------+-----------------------+
138| 11    | PA4                    | 12    | PC4 / **USB_POWER**   |
139+-------+------------------------+-------+-----------------------+
140| 13    | PC5                    | 14    | PB10                  |
141+-------+------------------------+-------+-----------------------+
142| 15    | P11                    | 16    | PB13                  |
143+-------+------------------------+-------+-----------------------+
144| 17    | PB12                   | 18    | PB14                  |
145+-------+------------------------+-------+-----------------------+
146| 19    | PB15                   | 20    | PC6                   |
147+-------+------------------------+-------+-----------------------+
148| 21    | PC7                    | 22    | PC8                   |
149+-------+------------------------+-------+-----------------------+
150| 23    | +5V USB                | 24    | PC9                   |
151+-------+------------------------+-------+-----------------------+
152| 25    | GND                    | 26    | VIN                   |
153+-------+------------------------+-------+-----------------------+
154
155
156Programming and Debugging
157*************************
158
159This board does not include any embedded debug tool interface, instead you
160will have to use an external probe connected to the available 20-pin JTAG
161connector to program and debug the board. Both JTAG and SWD are supported.
162
163By default when using ``west debug`` ST-Link will be used with OpenOCD's
164SWD transport, but it is also possible to use JTAG with the Olimex ARM-USB-OCD-H
165probe, for instance. For the latter, you should replace the file ``openocd.cfg``
166by ``openocd_olimex_jtag.cfg``, located in the board's support directory.
167
168The ``blackmagicprobe`` can also be used to program the device.
169
170Flashing
171========
172
173Here is an example for the :zephyr:code-sample:`button` application.
174
175.. zephyr-app-commands::
176   :zephyr-app: samples/basic/button
177   :board: olimex_stm32_h103
178   :goals: build flash
179
180Debugging
181=========
182
183You can debug an application in the usual way.  Here is an example for the
184:zephyr:code-sample:`hello_world` application.
185
186.. zephyr-app-commands::
187   :zephyr-app: samples/hello_world
188   :board: olimex_stm32_h103
189   :maybe-skip-config:
190   :goals: debug
191
192References
193**********
194
195- `OLIMEX-STM32-H103 website`_
196- `OLIMEX-STM32-H103 user manual`_
197- `OLIMEX-STM32-H103 schematic`_
198
199.. _OLIMEX-STM32-H103 website:
200   https://www.olimex.com/Products/ARM/ST/STM32-H103/
201
202.. _OLIMEX-STM32-H103 user manual:
203   https://www.olimex.com/Products/ARM/ST/STM32-H103/resources/STM32-H103.pdf
204
205.. _OLIMEX-STM32-H103 schematic:
206   https://www.olimex.com/Products/ARM/ST/STM32-H405/resources/STM32-H405_sch.pdf
207
208.. _ST STM32F103RB Datasheet:
209   https://www.st.com/resource/en/datasheet/stm32f103rb.pdf
210
211.. _STM32f103RB:
212   https://www.st.com/en/microcontrollers-microprocessors/stm32f103rb.html
213