1.. zephyr:board:: stm32l476g_disco
2
3Overview
4********
5
6The STM32L476G Discovery board features an ARM Cortex-M4 based STM32L476VG MCU
7with a wide range of connectivity support and configurations. Here are
8some highlights of the STM32L476G Discovery board:
9
10
11- STM32L476VGT6 microcontroller featuring 1 Mbyte of Flash memory, 128 Kbytes of RAM in LQFP100 package
12- On-board ST-LINK/V2-1 supporting USB re-enumeration capability
13- Three different interfaces supported on USB:
14
15    - Virtual com port
16    - Mass storage
17    - Debug port
18
19- LCD 24 segments, 4 commons in DIP 28 package
20- Seven LEDs:
21
22    - LD1 (red/green) for USB communication
23    - LD2 (red) for 3.3 V power on
24    - LD3 Over current (red)
25    - LD4 (red), LD5 (green) two user LEDs
26    - LD6 (green), LD7 (red) USB OTG FS LEDs
27
28- Pushbutton (reset)
29- Four directions Joystick with selection
30- USB OTG FS with micro-AB connector
31- SAI Audio DAC, Stereo with output jack
32- Digital microphone, accelerometer, magnetometer and gyroscope MEMS
33- 128-Mbit Quad-SPI Flash memory
34- MCU current ammeter with 4 ranges and auto-calibration
35- Connector for external board or RF-EEPROM
36- Four power supply options:
37    - ST-LINK/V2-1
38    - USB FS connector
39    - External 5 V
40    - CR2032 battery (not provided)
41
42More information about the board can be found at the `STM32L476G Discovery website`_.
43
44Hardware
45********
46
47The STM32L476VG SoC provides the following hardware features:
48
49- Ultra-low-power with FlexPowerControl (down to 130 nA Standby mode and 100 uA/MHz run mode)
50- Core: ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU, frequency up to 80 MHz, 100DMIPS/1.25DMIPS/MHz (Dhrystone 2.1)
51- Clock Sources:
52    - 4 to 48 MHz crystal oscillator
53    - 32 kHz crystal oscillator for RTC (LSE)
54    - Internal 16 MHz factory-trimmed RC ( |plusminus| 1%)
55    - Internal low-power 32 kHz RC ( |plusminus| 5%)
56    - Internal multispeed 100 kHz to 48 MHz oscillator, auto-trimmed by
57      LSE (better than  |plusminus| 0.25 % accuracy)
58    - 3 PLLs for system clock, USB, audio, ADC
59- RTC with HW calendar, alarms and calibration
60- LCD 8 x 40 or 4 x 44 with step-up converter
61- Up to 24 capacitive sensing channels: support touchkey, linear and rotary touch sensors
62- 16x timers:
63    - 2x 16-bit advanced motor-control
64    - 2x 32-bit and 5x 16-bit general purpose
65    - 2x 16-bit basic
66    - 2x low-power 16-bit timers (available in Stop mode)
67    - 2x watchdogs
68    - SysTick timer
69- Up to 114 fast I/Os, most 5 V-tolerant, up to 14 I/Os with independent supply down to 1.08 V
70- Memories
71    - Up to 1 MB Flash, 2 banks read-while-write, proprietary code readout protection
72    - Up to 128 KB of SRAM including 32 KB with hardware parity check
73    - External memory interface for static memories supporting SRAM, PSRAM, NOR and NAND memories
74    - Quad SPI memory interface
75- 4x digital filters for sigma delta modulator
76- Rich analog peripherals (independent supply)
77    - 3x 12-bit ADC 5 MSPS, up to 16-bit with hardware oversampling, 200 uA/MSPS
78    - 2x 12-bit DAC, low-power sample and hold
79    - 2x operational amplifiers with built-in PGA
80    - 2x ultra-low-power comparators
81- 18x communication interfaces
82    - USB OTG 2.0 full-speed, LPM and BCD
83    - 2x SAIs (serial audio interface)
84    - 3x I2C FM+(1 Mbit/s), SMBus/PMBus
85    - 6x USARTs (ISO 7816, LIN, IrDA, modem)
86    - 3x SPIs (4x SPIs with the Quad SPI)
87    - CAN (2.0B Active) and SDMMC interface
88    - SWPMI single wire protocol master I/F
89- 14-channel DMA controller
90- True random number generator
91- CRC calculation unit, 96-bit unique ID
92- Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell |trade|
93
94
95More information about STM32L476VG can be found here:
96       - `STM32L476VG on www.st.com`_
97       - `STM32L476 reference manual`_
98
99
100Supported Features
101==================
102
103The Zephyr stm32l476g_disco board configuration supports the following hardware features:
104
105+-----------+------------+-------------------------------------+
106| Interface | Controller | Driver/Component                    |
107+===========+============+=====================================+
108| NVIC      | on-chip    | nested vector interrupt controller  |
109+-----------+------------+-------------------------------------+
110| UART      | on-chip    | serial port-polling;                |
111|           |            | serial port-interrupt               |
112+-----------+------------+-------------------------------------+
113| PINMUX    | on-chip    | pinmux                              |
114+-----------+------------+-------------------------------------+
115| GPIO      | on-chip    | gpio                                |
116+-----------+------------+-------------------------------------+
117
118Other hardware features are not yet supported on this Zephyr port.
119
120The default configuration can be found in the defconfig file:
121
122	:zephyr_file:`boards/st/stm32l476g_disco/stm32l476g_disco_defconfig`
123
124
125Connections and IOs
126===================
127
128STM32L476G Discovery Board has 8 GPIO controllers. These controllers are responsible for pin muxing,
129input/output, pull-up, etc.
130
131For more details please refer to `STM32L476G Discovery board User Manual`_.
132
133Default Zephyr Peripheral Mapping:
134----------------------------------
135
136- UART_2_TX : PD5
137- UART_2_RX : PD6
138- LD4 : PB2
139- LD5 : PE8
140
141System Clock
142------------
143
144STM32L476G Discovery System Clock could be driven by an internal or external oscillator,
145as well as the main PLL clock. By default the System clock is driven by the PLL clock at 80MHz,
146driven by 16MHz high speed internal oscillator.
147
148Serial Port
149-----------
150
151STM32L476G Discovery board has 6 U(S)ARTs. The Zephyr console output is assigned to UART2.
152Default settings are 115200 8N1.
153
154
155Programming and Debugging
156*************************
157
158STM32L476G Discovery board includes an ST-LINK/V2-1 embedded debug tool interface.
159
160Flashing
161========
162
163The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
164so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
165
166Alternatively, OpenOCD or JLink can also be used to flash the board using
167the ``--runner`` (or ``-r``) option:
168
169.. code-block:: console
170
171   $ west flash --runner openocd
172   $ west flash --runner jlink
173
174Flashing an application to STM32L476G Discovery
175-----------------------------------------------
176
177Connect the STM32L476G Discovery to your host computer using the USB
178port, then run a serial host program to connect with your Discovery
179board. For example:
180
181.. code-block:: console
182
183   $ minicom -D /dev/ttyACM0
184
185Then, build and flash in the usual way. Here is an example for the
186:zephyr:code-sample:`hello_world` application.
187
188.. zephyr-app-commands::
189   :zephyr-app: samples/hello_world
190   :board: stm32l476g_disco
191   :goals: build flash
192
193You should see the following message on the console:
194
195.. code-block:: console
196
197   Hello World! arm
198
199Debugging
200=========
201
202You can debug an application in the usual way.  Here is an example for the
203:zephyr:code-sample:`hello_world` application.
204
205.. zephyr-app-commands::
206   :zephyr-app: samples/hello_world
207   :board: stm32l476g_disco
208   :maybe-skip-config:
209   :goals: debug
210
211.. _STM32L476G Discovery website:
212   https://www.st.com/en/evaluation-tools/32l476gdiscovery.html
213
214.. _STM32L476G Discovery board User Manual:
215   https://www.st.com/resource/en/user_manual/dm00172179.pdf
216
217.. _STM32L476VG on www.st.com:
218   https://www.st.com/en/microcontrollers/stm32l476vg.html
219
220.. _STM32L476 reference manual:
221   https://www.st.com/resource/en/reference_manual/DM00083560.pdf
222
223.. _STM32CubeProgrammer:
224   https://www.st.com/en/development-tools/stm32cubeprog.html
225