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