1.. _stm32f401_mini:
2
3STM32 Mini F401
4###############
5
6Overview
7********
8
9The STM32 Mini F401 is an extremely low cost and bare-bones
10development board featuring the STM32F401CC, see `STM32F401CC website`_.
11More info about the board with schematics available `here <stm32-base-board-page_>`_
12
13.. image:: img/STM32_Mini_F401-1.jpg
14      :align: center
15      :alt: STM32 Mini F401
16
17Hardware
18********
19
20The STM32F401CC based board provides the following
21hardware components:
22
23- STM32F401CCU6 in UFQFPN48 package
24- ARM |reg| 32-bit Cortex |reg| -M4 CPU with FPU
25- 84 MHz max CPU frequency
26- VDD from 1.7 V to 3.6 V
27- 256 KB Flash
28- 64 KB SRAM
29- GPIO with external interrupt capability
30- 1x12-bit, 2.4 MSPS ADC with 16 channels
31- DMA Controller
32- Up to 11 Timers (six 16-bit, two 32-bit, two watchdog timers and a SysTick timer)
33- USART/UART (3)
34- I2C (3)
35- SPI/I2S (4)
36- SDIO
37- USB 2.0 full-speed device/host/OTG controller with on-chip PHY
38- CRC calculation unit
39- 96-bit unique ID
40- RTC
41
42Supported Features
43==================
44
45The Zephyr stm32f401_mini board configuration supports the following
46hardware features:
47
48+------------+------------+-------------------------------------+
49| Interface  | Controller | Driver/Component                    |
50+============+============+=====================================+
51| NVIC       | on-chip    | nested vector interrupt controller  |
52+------------+------------+-------------------------------------+
53| SYSTICK    | on-chip    | system clock                        |
54+------------+------------+-------------------------------------+
55| UART       | on-chip    | serial port                         |
56+------------+------------+-------------------------------------+
57| GPIO       | on-chip    | gpio                                |
58+------------+------------+-------------------------------------+
59| PINMUX     | on-chip    | pinmux                              |
60+------------+------------+-------------------------------------+
61| FLASH      | on-chip    | flash                               |
62+------------+------------+-------------------------------------+
63| SPI        | on-chip    | spi                                 |
64+------------+------------+-------------------------------------+
65| I2C        | on-chip    | i2c                                 |
66+------------+------------+-------------------------------------+
67| ADC        | on-chip    | ADC Controller                      |
68+------------+------------+-------------------------------------+
69| USB OTG FS | on-chip    | USB device                          |
70+------------+------------+-------------------------------------+
71
72The default configuration can be found in the defconfig file:
73
74        ``boards/arm/stm32f401_mini/stm32f401_mini_defconfig``
75
76Default Zephyr Peripheral Mapping:
77----------------------------------
78
79- UART_1 TX/RX : PA9/PA10
80- I2C1 SCL/SDA : PB8/PB9
81- SPI1 CS/SCK/MISO/MOSI : PA4/PA5/PA6/PA7
82- PWM_4_CH1 : PB6
83- PWM_4_CH2 : PB7
84- ADC_1 : PA1
85- SW0 : PB2 (routed to BOOT1 dip switch)
86- LED0 : PC13
87
88Clock Sources
89-------------
90
91The board has two external oscillators. The frequency of the slow clock (LSE) is
9232.768 kHz. The frequency of the main clock (HSE) is 25 MHz.
93
94The default configuration sources the system clock from the PLL, which is
95derived from HSE, and is set at 84MHz.
96
97Programming and Debugging
98*************************
99
100There are 2 main entry points for flashing STM32F4X SoCs, one using the ROM
101bootloader, and another by using the SWD debug port (which requires additional
102hardware). Flashing using the ROM bootloader requires a special activation
103pattern, which can be triggered by using the BOOT0 pin, which on this board
104is a dip switch.
105
106Flashing
107========
108
109Installing dfu-util
110-------------------
111
112It is recommended to use at least v0.8 of `dfu-util`_. The package available in
113debian/ubuntu can be quite old, so you might have to build dfu-util from source.
114
115There is also a Windows version which works, but you may have to install the
116right USB drivers with a tool like `Zadig`_.
117
118Flashing an Application
119-----------------------
120
121Connect a USB-C cable and the board should power ON. Force the board into DFU mode
122by setting the BOOT0 dip switch position to ON. Reset the board with the NRST button.
123
124The dfu-util runner is supported on this board and so a sample can be built and
125tested easily.
126
127.. zephyr-app-commands::
128   :zephyr-app: samples/basic/blinky
129   :board: stm32f401_mini
130   :goals: build flash
131
132Debugging
133=========
134
135The board can be debugged by installing the included 100 mil (0.1 inch) header,
136and attaching an SWD debugger to the 3V3 (3.3V), GND, SCK, and DIO
137pins on that header.
138
139References
140**********
141
142.. target-notes::
143
144.. _Zadig:
145   https://zadig.akeo.ie/
146
147.. _stm32-base-board-page:
148   https://stm32-base.org/boards/STM32F401CCU6-STM32-Mini-F401
149
150.. _dfu-util:
151   http://dfu-util.sourceforge.net/build.html
152
153.. _STM32F401CC website:
154   https://www.st.com/en/microcontrollers-microprocessors/stm32f401cc.html
155