1.. zephyr:board:: nucleo_l412rb_p
2
3Overview
4********
5
6The Nucleo L412RB board features an ARM Cortex-M4 based STM32L412RB MCU
7with a wide range of connectivity support and configurations. Here are
8some highlights of the Nucleo L412RB board:
9
10- STM32 microcontroller in LQFP64 package
11- 1 user LED shared with ARDUINO |reg|
12- 1 user and 1 reset push-buttons
13- 32.768 kHz crystal oscillator
14- Two types of extension resources:
15
16  - Arduino Uno V3 connectivity
17  - ST morpho extension pin headers for full access to all STM32 I/Os
18
19- On-board ST-LINK debugger/programmer with USB re-enumeration capability: mass storage, Virtual COM port and debug port
20- Flexible power-supply options: ST-LINK, USB VBUS, or external sources
21
22  - USB VBUS or external source(3.3V, 5V, 7 - 12V)
23  - Power management access point
24
25- Board specific features
26
27  - External SMPS to generate Vcore logic supply
28  - 24 MHz HSE
29  - Board connectors:
30
31    - External SMPS experimentation dedicated connector
32    - Micro-AB or Mini-AB USB connector for the ST-LINK
33    - MIPI® debug connector
34
35  - Arm® Mbed Enabled |trade| compliant
36
37More information about the board can be found at the `Nucleo L412RB-P website`_.
38
39Hardware
40********
41
42Nucleo L412RB-P provides the following hardware components:
43
44- STM32L412RBT6 in LQFP64 package
45- Ultra-low-power with FlexPowerControl
46
47  - 1.71 V to 3.6 V power supply
48  - -40 °C to 85/125 °C temperature range
49  - 300 nA in VBAT mode: supply for RTC and 32x32-bit backup registers
50  - 16 nA Shutdown mode (4 wakeup pins)
51  - 32 nA Standby mode (4 wakeup pins)
52  - 245 nA Standby mode with RTC
53  - 0.7 |micro| A Stop 2 mode, 0.95 |micro| A with RTC
54  - 79 |micro| A/MHz run mode (LDO Mode)
55  - 28 |micro| A/MHz run mode (@3.3 V SMPS Mode)
56  - Batch acquisition mode (BAM)
57  - 4 |micro| s wakeup from Stop mode
58  - Brown out reset (BOR)
59  - Interconnect matrix
60
61- Core: Arm |reg| 32-bit Cortex |reg| -M4 CPU with FPU, Adaptive real-time accelerator (ART Accelerator |trade| ) allowing 0-wait-state execution from Flash memory, frequency up to 80 MHz, MPU, 100DMIPS and DSP instructions
62- Performance benchmark
63
64  - 1.25 DMIPS/MHz (Drystone 2.1)
65  - 273.55 CoreMark |reg| (3.42 CoreMark/MHz @ 80 MHz)
66
67- Energy benchmark
68
69  - 442 ULPMark-CP®
70  - 165 ULPMark-PP®
71
72- Clock Sources:
73
74  - 4 to 48 MHz crystal oscillator
75  - 32 kHz crystal oscillator for RTC (LSE)
76  - Internal 16 MHz factory-trimmed RC ( |plusminus| 1%)
77  - Internal low-power 32 kHz RC ( |plusminus| 5%)
78  - Internal multispeed 100 kHz to 48 MHz oscillator, auto-trimmed by LSE (better than |plusminus| 0.25 % accuracy)
79  - Internal 48 MHz with clock recovery
80  - PLL for system clock
81
82- Up to 52 fast I/Os, most 5 V-tolerant
83- RTC with HW calendar, alarms and calibration
84- Up to 12 capacitive sensing channels: support touchkey, linear and rotary touch sensors
85- 10x timers:
86
87  - 1x 16-bit advanced motor-control
88  - 1x 32-bit and 2x 16-bit general purpose
89  - 1x 16-bit basic
90  - 2x low-power 16-bit timers (available in Stop mode)
91  - 2x watchdogs
92  - SysTick timer
93
94- Memories
95
96  - 128 KB single bank Flash, proprietary code readout protection
97  - 40 KB of SRAM including 8 KB with hardware parity check
98  - Quad SPI memory interface with XIP capability
99
100- Rich analog peripherals (independent supply)
101
102  - 2x 12-bit ADC 5 Msps, up to 16-bit with hardware oversampling, 200 |micro| A/Msps
103  - 2x operational amplifiers with built-in PGA
104  - 1x ultra-low-power comparator
105  - Accurate 2.5 V or 2.048 V reference voltage buffered output
106
107- 12x communication interfaces
108  - USB 2.0 full-speed crystal less solution with LPM and BCD
109  - 3x I2C FM+(1 Mbit/s), SMBus/PMBus
110  - 3x USARTs (ISO 7816, LIN, IrDA, modem)
111  - 1x LPUART (Stop 2 wake-up)
112  - 2x SPIs (and 1x Quad SPI)
113  - IRTIM (Infrared interface)
114
115- 14-channel DMA controller
116- True random number generator
117- CRC calculation unit, 96-bit unique ID
118- Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell |trade|
119- All packages are ECOPACK2 compliant
120
121Note: the current board revision is C. (MB1319C)
122
123More information about STM32L412RB can be found here:
124
125- `STM32L412RB on www.st.com`_
126- `STM32L412 reference manual`_
127
128Supported Features
129==================
130
131The Zephyr ``nucleo_l412rb_p`` board configuration supports the following hardware features:
132
133+-----------+------------+-------------------------------------+
134| Interface | Controller | Driver/Component                    |
135+===========+============+=====================================+
136| NVIC      | on-chip    | nested vector interrupt controller  |
137+-----------+------------+-------------------------------------+
138| UART      | on-chip    | serial port-polling;                |
139|           |            | serial port-interrupt               |
140+-----------+------------+-------------------------------------+
141| PINMUX    | on-chip    | pinmux                              |
142+-----------+------------+-------------------------------------+
143| GPIO      | on-chip    | gpio                                |
144+-----------+------------+-------------------------------------+
145| I2C       | on-chip    | i2c                                 |
146+-----------+------------+-------------------------------------+
147| SPI       | on-chip    | spi                                 |
148+-----------+------------+-------------------------------------+
149| ADC       | on-chip    | ADC Controller                      |
150+-----------+------------+-------------------------------------+
151| PWM       | on-chip    | pwm                                 |
152+-----------+------------+-------------------------------------+
153
154Other hardware features are not yet supported on this Zephyr port.
155
156The default configuration can be found in the defconfig file:
157:zephyr_file:`boards/st/nucleo_l412rb_p/nucleo_l412rb_p_defconfig`
158
159
160Connections and IOs
161===================
162
163Nucleo L412RB-P Board has 5 GPIO controllers (Ports A, B, C, D and H). These controllers are responsible for pin muxing,
164input/output, pull-up, etc.
165
166Available pins:
167---------------
168.. image:: img/nucleo_l412rb_p_pinout.jpg
169   :align: center
170   :alt: Nucleo L412RB-P
171
172For more details please refer to `ST Nucleo L412RB-P User Manual`_.
173
174Default Zephyr Peripheral Mapping:
175----------------------------------
176
177- LPUART1 TX/RX : PA2/PA3
178- I2C1 SCL/SDA  : PB8/PB7 (Arduino I2C)
179- SPI2 CS/SCK/MISO/MOSI : PA11/PB13/PB14/PB15 (Arduino SPI)
180- UART1 TX/RX : PA9/PA10
181- PWM_2_CH1 : PA0
182- USER_PB   : PC13
183- LD4 : PB13
184
185Note: SPI2 CS pin (PB12) is not located on the Arduino connector.
186
187System Clock
188------------
189
190Nucleo L412RB-P System Clock could be driven by internal or external oscillator,
191as well as main PLL clock. By default System clock is driven by PLL clock at 80MHz,
192driven by 16MHz high speed internal oscillator.
193
194Serial Port
195-----------
196
197Nucleo L412RB-P board has 3 U(S)ARTs and 1 LPUART. The Zephyr console output is assigned to LPUART1.
198Default settings are 115200 8N1.
199
200
201Programming and Debugging
202*************************
203
204Nucleo L412RB-P board includes an ST-LINK/V2-1 embedded debug tool interface.
205
206Applications for the ``nucleo_l412rb_p`` board configuration can be built and
207flashed in the usual way (see :ref:`build_an_application` and
208:ref:`application_run` for more details).
209
210Flashing
211========
212
213The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
214so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
215
216Alternatively, OpenOCD or JLink can also be used to flash the board using
217the ``--runner`` (or ``-r``) option:
218
219.. code-block:: console
220
221   $ west flash --runner openocd
222   $ west flash --runner jlink
223
224Flashing an application to Nucleo L412RB-P
225------------------------------------------
226
227Connect the Nucleo L412RB-P to your host computer using the USB port,
228then run a serial host program to connect with your Nucleo board.
229
230.. code-block:: console
231
232   $ minicom -D /dev/ttyACM0
233
234Now build and flash an application. Here is an example for
235:zephyr:code-sample:`hello_world`.
236
237.. zephyr-app-commands::
238   :zephyr-app: samples/hello_world
239   :board: nucleo_l412rb_p
240   :goals: build flash
241
242You should see the following message on the console:
243
244.. code-block:: console
245
246   $ Hello World! nucleo_l412rb_p
247
248
249Debugging
250=========
251
252You can debug an application in the usual way.  Here is an example for the
253:zephyr:code-sample:`hello_world` application.
254
255.. zephyr-app-commands::
256   :zephyr-app: samples/hello_world
257   :board: nucleo_l412rb_p
258   :maybe-skip-config:
259   :goals: debug
260
261.. _Nucleo L412RB-P website:
262   https://www.st.com/en/evaluation-tools/nucleo-l412rb-p.html
263
264.. _ST Nucleo L412RB-P User Manual:
265   https://www.st.com/resource/en/user_manual/dm00387966-stm32-nucleo-64-p-boards-stmicroelectronics.pdf
266
267.. _STM32L412RB on www.st.com:
268   https://www.st.com/en/microcontrollers-microprocessors/stm32l412rb.html
269
270.. _STM32L412 reference manual:
271   https://www.st.com/resource/en/reference_manual/dm00151940-stm32l41xxx42xxx43xxx44xxx45xxx46xxx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
272
273.. _STM32CubeProgrammer:
274   https://www.st.com/en/development-tools/stm32cubeprog.html
275