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 the defconfig file:
75
76        ``boards/arm/blackpill_f401ce/blackpill_f401ce_defconfig``
77
78Pin Mapping
79===========
80
81Available pins:
82---------------
83.. image:: img/Blackpill_Pinout.jpg
84      :align: center
85      :alt: Black Pill V3.0+ Pinout
86
87Default Zephyr Peripheral Mapping:
88----------------------------------
89
90- UART_1 TX/RX : PA9/PA10
91- I2C1 SCL/SDA : PB8/PB9
92- SPI1 CS/SCK/MISO/MOSI : PA4/PA5/PA6/PA7 (Routed to footprint for external flash)
93- PWM_4_CH1 : PB6
94- PWM_4_CH2 : PB7
95- ADC_1 : PA1
96- USER_PB : PA0
97- USER_LED : PC13
98
99Note on SPI pin mapping: According to the `board release notes`_, there was a brief
100change for V2.0 specifically where MISO was routed to PB4 for the flash footprint.
101This was reverted for V2.1+ so that the flash DO pin was routed back to PA6. If using
102V2.0 and en external flash, the pinmux will need to be modified accordingly.
103
104Clock Sources
105-------------
106
107The board has two external oscillators. The frequency of the slow clock (LSE) is
10832.768 kHz. The frequency of the main clock (HSE) is 25 MHz.
109
110The default configuration sources the system clock from the PLL, which is
111derived from HSE, and is set at 84MHz, which is the maximum possible frequency
112to achieve a stable USB clock (42MHz).
113
114Programming and Debugging
115*************************
116
117There are 2 main entry points for flashing STM32F4X SoCs, one using the ROM
118bootloader, and another by using the SWD debug port (which requires additional
119hardware). Flashing using the ROM bootloader requires a special activation
120pattern, which can be triggered by using the BOOT0 pin.
121
122Flashing
123========
124
125Installing dfu-util
126-------------------
127
128It is recommended to use at least v0.8 of `dfu-util`_. The package available in
129debian/ubuntu can be quite old, so you might have to build dfu-util from source.
130
131There is also a Windows version which works, but you may have to install the
132right USB drivers with a tool like `Zadig`_.
133
134Flashing an Application
135-----------------------
136
137Connect a USB-C cable and the board should power ON. Force the board into DFU mode
138by keeping the BOOT0 switch pressed while pressing and releasing the NRST switch.
139
140The dfu-util runner is supported on this board and so a sample can be built and
141tested easily.
142
143.. zephyr-app-commands::
144   :zephyr-app: samples/basic/blinky
145   :board: blackpill_f401ce
146   :goals: build flash
147
148Debugging
149=========
150
151The board can be debugged by installing the included 100 mil (0.1 inch) header,
152and attaching an SWD debugger to the 3V3 (3.3V), GND, SCK, and DIO
153pins on that header.
154
155References
156**********
157
158.. target-notes::
159
160.. _board release notes:
161   https://github.com/WeActStudio/WeActStudio.MiniSTM32F4x1/blob/master/HDK/README.md
162
163.. _Zadig:
164   https://zadig.akeo.ie/
165
166.. _WeAct Github:
167   https://github.com/WeActStudio/WeActStudio.MiniSTM32F4x1
168
169.. _stm32-base-board-page:
170   https://stm32-base.org/boards/STM32F401CEU6-WeAct-Black-Pill-V3.0.html
171
172.. _dfu-util:
173   http://dfu-util.sourceforge.net/build.html
174
175.. _STM32F401CE website:
176   https://www.st.com/en/microcontrollers/stm32f401ce.html
177
178.. _STM32F401x reference manual:
179   https://www.st.com/resource/en/reference_manual/dm00096844.pdf
180