1.. zephyr:board:: blackpill_f401ce
2
3Overview
4********
5
6The WeAct Black Pill V3.0 Board is an extremely low cost and bare-bones
7development board featuring the STM32F401CE, see `STM32F401CE website`_.
8This is the 48-pin variant of the STM32F401x series,
9see `STM32F401x reference manual`_. More info about the board available
10`here <stm32-base-board-page_>`_ and on `WeAct Github`_.
11
12Hardware
13********
14
15The STM32F401CE based Black Pill V3.0+ Board provides the following
16hardware components:
17
18- STM32F401CEU6 in UFQFPN48 package
19- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU
20- 84 MHz max CPU frequency
21- VDD from 1.7 V to 3.6 V
22- 512 KB Flash
23- 96 KB SRAM
24- GPIO with external interrupt capability
25- 1x12-bit, 2.4 MSPS ADC with 16 channels
26- DMA Controller
27- Up to 11 Timers (six 16-bit, two 32-bit, two watchdog timers and a SysTick timer)
28- USART/UART (3)
29- I2C (3)
30- SPI/I2S (5)
31- SDIO
32- USB 2.0 full-speed device/host/OTG controller with on-chip PHY
33- CRC calculation unit
34- 96-bit unique ID
35- RTC
36
37Supported Features
38==================
39
40The Zephyr blackpill_f401ce board configuration supports the following
41hardware features:
42
43+------------+------------+-------------------------------------+
44| Interface  | Controller | Driver/Component                    |
45+============+============+=====================================+
46| NVIC       | on-chip    | nested vector interrupt controller  |
47+------------+------------+-------------------------------------+
48| SYSTICK    | on-chip    | system clock                        |
49+------------+------------+-------------------------------------+
50| UART       | on-chip    | serial port                         |
51+------------+------------+-------------------------------------+
52| GPIO       | on-chip    | gpio                                |
53+------------+------------+-------------------------------------+
54| PINMUX     | on-chip    | pinmux                              |
55+------------+------------+-------------------------------------+
56| FLASH      | on-chip    | flash                               |
57+------------+------------+-------------------------------------+
58| SPI        | on-chip    | spi                                 |
59+------------+------------+-------------------------------------+
60| I2C        | on-chip    | i2c                                 |
61+------------+------------+-------------------------------------+
62| ADC        | on-chip    | ADC Controller                      |
63+------------+------------+-------------------------------------+
64| USB OTG FS | on-chip    | USB device                          |
65+------------+------------+-------------------------------------+
66
67The default configuration can be found in
68:zephyr_file:`boards/weact/blackpill_f401ce/blackpill_f401ce_defconfig`
69
70Pin Mapping
71===========
72
73Available pins:
74---------------
75.. image:: img/Blackpill_Pinout.jpg
76      :align: center
77      :alt: Black Pill V3.0+ Pinout
78
79Default Zephyr Peripheral Mapping:
80----------------------------------
81
82- UART_1 TX/RX : PA9/PA10
83- I2C1 SCL/SDA : PB8/PB9
84- SPI1 CS/SCK/MISO/MOSI : PA4/PA5/PA6/PA7 (Routed to footprint for external flash)
85- PWM_4_CH1 : PB6
86- PWM_4_CH2 : PB7
87- ADC_1 : PA1
88- USER_PB : PA0
89- USER_LED : PC13
90
91Note on SPI pin mapping: According to the `board release notes`_, there was a brief
92change for V2.0 specifically where MISO was routed to PB4 for the flash footprint.
93This was reverted for V2.1+ so that the flash DO pin was routed back to PA6. If using
94V2.0 and en external flash, the pinmux will need to be modified accordingly.
95
96Clock Sources
97-------------
98
99The board has two external oscillators. The frequency of the slow clock (LSE) is
10032.768 kHz. The frequency of the main clock (HSE) is 25 MHz.
101
102The default configuration sources the system clock from the PLL, which is
103derived from HSE, and is set at 84MHz, which is the maximum possible frequency
104to achieve a stable USB clock (42MHz).
105
106Programming and Debugging
107*************************
108
109There are 2 main entry points for flashing STM32F4X SoCs, one using the ROM
110bootloader, and another by using the SWD debug port (which requires additional
111hardware). Flashing using the ROM bootloader requires a special activation
112pattern, which can be triggered by using the BOOT0 pin.
113
114Flashing
115========
116
117Installing dfu-util
118-------------------
119
120It is recommended to use at least v0.8 of `dfu-util`_. The package available in
121debian/ubuntu can be quite old, so you might have to build dfu-util from source.
122
123There is also a Windows version which works, but you may have to install the
124right USB drivers with a tool like `Zadig`_.
125
126Flashing an Application
127-----------------------
128
129Connect a USB-C cable and the board should power ON. Force the board into DFU mode
130by keeping the BOOT0 switch pressed while pressing and releasing the NRST switch.
131
132The dfu-util runner is supported on this board and so a sample can be built and
133tested easily.
134
135.. zephyr-app-commands::
136   :zephyr-app: samples/basic/blinky
137   :board: blackpill_f401ce
138   :goals: build flash
139
140Debugging
141=========
142
143The board can be debugged by installing the included 100 mil (0.1 inch) header,
144and attaching an SWD debugger to the 3V3 (3.3V), GND, SCK, and DIO
145pins on that header.
146
147References
148**********
149
150.. target-notes::
151
152.. _board release notes:
153   https://github.com/WeActStudio/WeActStudio.MiniSTM32F4x1/blob/master/HDK/README.md
154
155.. _Zadig:
156   https://zadig.akeo.ie/
157
158.. _WeAct Github:
159   https://github.com/WeActStudio/WeActStudio.MiniSTM32F4x1
160
161.. _stm32-base-board-page:
162   https://stm32-base.org/boards/STM32F401CEU6-WeAct-Black-Pill-V3.0.html
163
164.. _dfu-util:
165   http://dfu-util.sourceforge.net/build.html
166
167.. _STM32F401CE website:
168   https://www.st.com/en/microcontrollers/stm32f401ce.html
169
170.. _STM32F401x reference manual:
171   https://www.st.com/resource/en/reference_manual/dm00096844.pdf
172