1.. zephyr:board:: nucleo_l476rg
2
3Overview
4********
5
6The Nucleo L476RG board features an ARM Cortex-M4 based STM32L476RG MCU
7with a wide range of connectivity support and configurations. Here are
8some highlights of the Nucleo L476RG board:
9
10
11- STM32 microcontroller in QFP64 package
12- Two types of extension resources:
13
14  - Arduino Uno V3 connectivity
15  - ST morpho extension pin headers for full access to all STM32 I/Os
16
17- On-board ST-LINK/V2-1 debugger/programmer with SWD connector
18- Flexible board power supply:
19
20   - USB VBUS or external source(3.3V, 5V, 7 - 12V)
21   - Power management access point
22
23- Three LEDs: USB communication (LD1), user LED (LD2), power LED (LD3)
24- Two push-buttons: USER and RESET
25
26More information about the board can be found at the `Nucleo L476RG website`_.
27
28Hardware
29********
30
31The STM32L476RG SoC provides the following hardware IPs:
32
33- Ultra-low-power with FlexPowerControl (down to 130 nA Standby mode and 100 uA/MHz run mode)
34- Core: ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU, frequency up to 80 MHz, 100DMIPS/1.25DMIPS/MHz (Dhrystone 2.1)
35- Clock Sources:
36
37  - 4 to 48 MHz crystal oscillator
38  - 32 kHz crystal oscillator for RTC (LSE)
39  - Internal 16 MHz factory-trimmed RC ( |plusminus| 1%)
40  - Internal low-power 32 kHz RC ( |plusminus| 5%)
41  - Internal multispeed 100 kHz to 48 MHz oscillator, auto-trimmed by
42    LSE (better than  |plusminus| 0.25 % accuracy)
43  - 3 PLLs for system clock, USB, audio, ADC
44
45- RTC with HW calendar, alarms and calibration
46- LCD 8 x 40 or 4 x 44 with step-up converter
47- Up to 24 capacitive sensing channels: support touchkey, linear and rotary touch sensors
48- 16x timers:
49
50  - 2x 16-bit advanced motor-control
51  - 2x 32-bit and 5x 16-bit general purpose
52  - 2x 16-bit basic
53  - 2x low-power 16-bit timers (available in Stop mode)
54  - 2x watchdogs
55  - SysTick timer
56
57- Up to 114 fast I/Os, most 5 V-tolerant, up to 14 I/Os with independent supply down to 1.08 V
58- Memories
59
60  - Up to 1 MB Flash, 2 banks read-while-write, proprietary code readout protection
61  - Up to 128 KB of SRAM including 32 KB with hardware parity check
62  - External memory interface for static memories supporting SRAM, PSRAM, NOR and NAND memories
63  - Quad SPI memory interface
64
65- 4x digital filters for sigma delta modulator
66- Rich analog peripherals (independent supply)
67
68  - 3x 12-bit ADC 5 MSPS, up to 16-bit with hardware oversampling, 200 uA/MSPS
69  - 2x 12-bit DAC, low-power sample and hold
70  - 2x operational amplifiers with built-in PGA
71  - 2x ultra-low-power comparators
72
73- 18x communication interfaces
74
75  - USB OTG 2.0 full-speed, LPM and BCD
76  - 2x SAIs (serial audio interface)
77  - 3x I2C FM+(1 Mbit/s), SMBus/PMBus
78  - 6x USARTs (ISO 7816, LIN, IrDA, modem)
79  - 3x SPIs (4x SPIs with the Quad SPI)
80  - CAN (2.0B Active) and SDMMC interface
81  - SWPMI single wire protocol master I/F
82
83- 14-channel DMA controller
84- True random number generator
85- CRC calculation unit, 96-bit unique ID
86- Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell |trade|
87
88
89More information about STM32L476RG can be found here:
90
91- `STM32L476RG on www.st.com`_
92- `STM32L476 reference manual`_
93
94Supported Features
95==================
96
97The Zephyr nucleo_l476rg board configuration supports the following hardware features:
98
99+-----------+------------+-------------------------------------+
100| Interface | Controller | Driver/Component                    |
101+===========+============+=====================================+
102| NVIC      | on-chip    | nested vector interrupt controller  |
103+-----------+------------+-------------------------------------+
104| UART      | on-chip    | serial port-polling;                |
105|           |            | serial port-interrupt               |
106+-----------+------------+-------------------------------------+
107| PINMUX    | on-chip    | pinmux                              |
108+-----------+------------+-------------------------------------+
109| GPIO      | on-chip    | gpio                                |
110+-----------+------------+-------------------------------------+
111| I2C       | on-chip    | i2c                                 |
112+-----------+------------+-------------------------------------+
113| PWM       | on-chip    | pwm                                 |
114+-----------+------------+-------------------------------------+
115| SPI       | on-chip    | spi                                 |
116+-----------+------------+-------------------------------------+
117| ADC       | on-chip    | ADC Controller                      |
118+-----------+------------+-------------------------------------+
119
120Other hardware features are not yet supported on this Zephyr port.
121
122The default configuration can be found in the defconfig file:
123:zephyr_file:`boards/st/nucleo_l476rg/nucleo_l476rg_defconfig`
124
125
126Connections and IOs
127===================
128
129Nucleo L476RG Board has 8 GPIO controllers. These controllers are responsible for pin muxing,
130input/output, pull-up, etc.
131
132Available pins:
133---------------
134.. image:: img/nucleo_l476rg_arduino.jpg
135   :align: center
136   :alt: Nucleo L476RG Arduino connectors
137.. image:: img/nucleo_l476rg_morpho.jpg
138   :align: center
139   :alt: Nucleo L476RG Morpho connectors
140
141For more details please refer to `STM32 Nucleo-64 board User Manual`_.
142
143Default Zephyr Peripheral Mapping:
144----------------------------------
145
146.. rst-class:: rst-columns
147
148- UART_1 TX/RX  : PA9/PA10
149- UART_2 TX/RX  : PA2/PA3 (ST-Link Virtual Port Com)
150- UART_3 TX/RX  : PB10/PB11
151- I2C_1 SCL/SDA : PB8/PB9 (Arduino I2C)
152- I2C_3 SCL/SDA : PC0/PC1
153- SPI_1 CS/SCK/MISO/MOSI : PB6/PA5/PA6/PA7 (Arduino SPI)
154- SPI_2 CS/SCK/MISO/MOSI : PB12/PB13/PB14/PB15
155- SPI_3 CS/SCK/MISO/MOSI : PA15/PC10/PC11/PC12
156- PWM_2_CH1 : PA0
157- USER_PB   : PC13
158- LD2       : PA5
159
160System Clock
161------------
162
163Nucleo L476RG System Clock could be driven by internal or external oscillator,
164as well as main PLL clock. By default System clock is driven by PLL clock at 80MHz,
165driven by 16MHz high speed internal oscillator.
166
167Serial Port
168-----------
169
170Nucleo L476RG board has 6 U(S)ARTs. The Zephyr console output is assigned to UART2.
171Default settings are 115200 8N1.
172
173
174Programming and Debugging
175*************************
176
177Nucleo L476RG board includes an ST-LINK/V2-1 embedded debug tool interface.
178
179Applications for the ``nucleo_l476rg`` board configuration can be built and
180flashed in the usual way (see :ref:`build_an_application` and
181:ref:`application_run` for more details).
182
183Flashing
184========
185
186The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
187so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
188
189Alternatively, OpenOCD or JLink can also be used to flash the board using
190the ``--runner`` (or ``-r``) option:
191
192.. code-block:: console
193
194   $ west flash --runner openocd
195   $ west flash --runner jlink
196
197Flashing an application to Nucleo L476RG
198----------------------------------------
199
200Connect the Nucleo L476RG to your host computer using the USB port.
201Then build and flash an application. Here is an example for the
202:zephyr:code-sample:`hello_world` application.
203
204Run a serial host program to connect with your Nucleo board:
205
206.. code-block:: console
207
208   $ minicom -D /dev/ttyACM0
209
210Then build and flash the application.
211
212.. zephyr-app-commands::
213   :zephyr-app: samples/hello_world
214   :board: nucleo_l476rg
215   :goals: build flash
216
217You should see the following message on the console:
218
219.. code-block:: console
220
221   Hello World! arm
222
223Debugging
224=========
225
226You can debug an application in the usual way.  Here is an example for the
227:zephyr:code-sample:`hello_world` application.
228
229.. zephyr-app-commands::
230   :zephyr-app: samples/hello_world
231   :board: nucleo_l476rg
232   :maybe-skip-config:
233   :goals: debug
234
235.. _Nucleo L476RG website:
236   https://www.st.com/en/evaluation-tools/nucleo-l476rg.html
237
238.. _STM32 Nucleo-64 board User Manual:
239   https://www.st.com/resource/en/user_manual/dm00105823.pdf
240
241.. _STM32L476RG on www.st.com:
242   https://www.st.com/en/microcontrollers/stm32l476rg.html
243
244.. _STM32L476 reference manual:
245   https://www.st.com/resource/en/reference_manual/DM00083560.pdf
246
247.. _STM32CubeProgrammer:
248   https://www.st.com/en/development-tools/stm32cubeprog.html
249