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