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