1.. zephyr:board:: stm32l1_disco
2
3Overview
4********
5
6The two generations of the STM32L1 Discovery development boards come with
7an integrated ST-LINK/V2 debugger and programmer.  The boards have a
824-segment LCD and a touch slider, along with two user LEDs and a user button.
9Support circuitry for measuring power consumption is also available.
10It also comes with a comprehensive STM32 software HAL library and various
11packaged software examples.
12
13There
14are two variants of the board:
15
16- STM32LDISCOVERY targets STM32L152RBT6, with 128K flash, 16K RAM, 4K EEPROM
17- STM32L152CDISCOVERY targets STM32L152RCT6, with 256K flash, 32K RAM, 8K EEPROM
18
19The STM32LDISCOVERY is no longer sold, but was widely available.
20stm32l1_disco configuration enables support for STM32LDISCOVERY board and
21stm32l152c_disco configuration enables support for STM32L152CDISCOVERY board.
22
23
24More information about the board can be found at the `STM32LDISCOVERY website`_.
25
26Hardware
27********
28
29The STM32 Discovery board features:
30
31- On-board ST-LINK/V2 with selection mode switch to use the kit as a standalone
32  ST-LINK/V2 (with SWD connector for programming and debugging)
33- Board power supply: through USB bus or from an external 5 V supply voltage
34- External application power supply: 3 V and 5 V
35- Four LEDs:
36
37    - LD1 (red) for 3.3 V power on
38    - LD2 (red/green) for USB communication
39    - LD3 (green) for PC9 output
40    - LD4 (blue) for PC8 output
41- Two push buttons (user and reset)
42- Extension header for all LQFP64 I/Os for quick connection to prototyping board
43  and easy probing
44
45More information about STM32L151x can be found in the `STM32L1x reference manual`_.
46
47Supported Features
48==================
49
50The Zephyr stm32l1_disco and stm32l152c_disco board configurations support
51the following hardware features:
52
53.. list-table:: Supported hardware
54   :header-rows: 1
55
56   * - Interface
57     - Controller
58     - Driver/component
59   * - NVIC
60     - on-chip
61     - nested vector interrupt controller
62   * - UART
63     - on-chip
64     - serial port-polling
65       serial port-interrupt
66   * - PINMUX
67     - on-chip
68     - pinmux
69   * - GPIO
70     - on-chip
71     - gpio
72   * - CLOCK
73     - on-chip
74     - reset and clock control
75   * - FLASH
76     - on-chip
77     - flash memory
78   * - EEPROM
79     - on-chip
80     - eeprom
81   * - WATCHDOG
82     - on-chip
83     - window watchdog
84   * - I2C
85     - on-chip
86     - i2c
87   * - SPI
88     - on-chip
89     - spi
90
91Other hardware features are not yet supported in this Zephyr port.
92
93The configuration of stm32l1_disco can be found in
94:zephyr_file:`boards/st/stm32l1_disco/stm32l1_disco_defconfig`
95
96Configuration of stm32l152c_disco can be found in
97:zephyr_file:`boards/st/stm32l1_disco/stm32l152c_disco_defconfig`
98
99Connections and IOs
100===================
101
102Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
103input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
104GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
105capable except for analog inputs.
106
107Default Zephyr Peripheral Mapping:
108----------------------------------
109
110.. rst-class:: rst-columns
111
112- UART_1_TX : PA9
113- UART_1_RX : PA10
114- UART_2_TX : PA2
115- UART_2_RX : PA3
116- I2C1_SCL : PB6
117- I2C1_SDA : PB7
118- I2C2_SCL : PB10
119- I2C2_SDA : PB11
120- SPI1_NSS : PA4
121- SPI1_SCK : PA5
122- SPI1_MISO : PA6
123- SPI1_MOSI : PA7
124- SPI2_NSS : PB12
125- SPI2_SCK : PB13
126- SPI2_MISO : PB14
127- SPI2_MOSI : PB15
128
129For more details please refer to `STM32L1DISCOVERY board User Manual`_.
130
131Programming and Debugging
132*************************
133
134STM32L1DISCOVERY and STM32L152CDISCOVERY boards include an ST-LINK/V2 embedded debug tool interface.
135
136Applications for the ``stm32l1_disco`` board configuration can be built and
137flashed in the usual way (see :ref:`build_an_application` and
138:ref:`application_run` for more details).
139
140Flashing
141========
142
143The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
144so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
145
146Alternatively, OpenOCD or JLink can also be used to flash the board using
147the ``--runner`` (or ``-r``) option:
148
149.. code-block:: console
150
151   $ west flash --runner openocd
152   $ west flash --runner jlink
153
154Flashing an application
155-----------------------
156
157Here is an example for the :zephyr:code-sample:`blinky` application.
158
159.. zephyr-app-commands::
160   :zephyr-app: samples/basic/blinky
161   :board: stm32l1_disco
162   :goals: build flash
163
164You will see the LED blinking every second.
165
166Debugging
167=========
168
169You can debug an application in the usual way.  Here is an example for the
170:zephyr:code-sample:`blinky` application.
171
172.. zephyr-app-commands::
173   :zephyr-app: samples/basic/blinky
174   :board: stm32l1_disco
175   :maybe-skip-config:
176   :goals: debug
177
178References
179**********
180
181.. target-notes::
182
183.. _STM32LDISCOVERY website:
184   https://www.st.com/en/evaluation-tools/32l152cdiscovery.html
185
186.. _STM32L1x reference manual:
187   https://www.st.com/resource/en/reference_manual/cd00240193.pdf
188
189.. _STM32L1DISCOVERY board User Manual:
190   https://www.st.com/resource/en/user_manual/dm00027954.pdf
191
192.. _STM32L152CDISCOVERY board User Manual:
193   https://www.st.com/resource/en/user_manual/um1079-discovery-kit-with-stm32l152rc-mcu-stmicroelectronics.pdf
194
195.. _STM32CubeProgrammer:
196   https://www.st.com/en/development-tools/stm32cubeprog.html
197