1.. zephyr:board:: b_l072z_lrwan1
2
3Overview
4********
5
6This Discovery kit features an all-in-one open module CMWX1ZZABZ-091 (by Murata).
7The module is powered by an STM32L072CZ and an SX1276 transceiver.
8
9This kit provides:
10
11- CMWX1ZZABZ-091 LoRa* / Sigfox* module (Murata)
12
13        - Embedded ultra-low-power STM32L072CZ Series MCUs, based on
14          Arm* Cortex* -M0+ core, with 192 Kbytes of Flash
15          memory, 20 Kbytes of RAM, 6 Kbytes of EEPROM
16        - Frequency range: 860 MHz - 930 MHz
17        - USB 2.0 FS
18        - 4-channel,12-bit ADC, 2xDAC
19        - 6-bit timers, LP-UART, I2C and SPI
20        - Embedded SX1276 transceiver
21        - LoRa* , FSK, GFSK, MSK, GMSK and OOK modulations (+ Sigfox* compatibility)
22        - +14 dBm or +20 dBm selectable output power
23        - 157 dB maximum link budget
24        - Programmable bit rate up to 300 kbit/s
25        - High sensitivity: down to -137 dBm
26        - Bullet-proof front end: IIP3 = -12.5 dBm
27        - 89 dB blocking immunity
28        - Low Rx current of 10 mA, 200 nA register retention
29        - Fully integrated synthesizer with a resolution of 61 Hz
30        - Built-in bit synchronizer for clock recovery
31        - Sync word recognition
32        - Preamble detection
33        - 127 dB+ dynamic range RSSI
34
35- SMA and U.FL RF interface connectors
36- Including 50 ohm SMA RF antenna
37- On-board ST-LINK/V2-1 supporting USB re-enumeration capability
38
39- USB ST-LINK functions:
40- Board power supply:
41
42        - Through USB bus or external VIN/3.3 V supply voltage or batteries
43- 3xAAA-type-battery holder for standalone operation
44- 7 LEDs:
45
46        - 4 general-purpose LEDs
47        - A 5 V-power LED
48        - An ST-LINK-communication LED
49        - A fault-power LED
50        - 2 push-buttons (user and reset)
51- Arduino* Uno V3 connectors
52
53More information about the board can be found at the `B-L072Z-LRWAN1 website`_.
54
55Hardware
56********
57
58The STM32L072CZ SoC provides the following hardware IPs:
59
60- Ultra-low-power (down to 0.29 µA Standby mode and 93 uA/MHz run mode)
61- Core: ARM* 32-bit Cortex*-M0+ CPU, frequency up to 32 MHz
62- Clock Sources:
63
64        - 1 to 32 MHz crystal oscillator
65        - 32 kHz crystal oscillator for RTC (LSE)
66        - Internal 16 MHz factory-trimmed RC ( |plusminus| 1%)
67        - Internal low-power 37 kHz RC ( |plusminus| 5%)
68        - Internal multispeed low-power 65 kHz to 4.2 MHz RC
69- RTC with HW calendar, alarms and calibration
70- Up to 24 capacitive sensing channels: support touchkey, linear and rotary touch sensors
71- 11x timers:
72
73        - 2x 16-bit with up to 4 channels
74        - 2x 16-bit with up to 2 channels
75        - 1x 16-bit ultra-low-power timer
76        - 1x SysTick
77        - 1x RTC
78        - 2x 16-bit basic for DAC
79        - 2x watchdogs (independent/window)
80- Up to 84 fast I/Os, most 5 V-tolerant.
81- Memories
82
83        - Up to 192 KB Flash, 2 banks read-while-write, proprietary code readout protection
84        - Up to 20 KB of SRAM
85        - External memory interface for static memories supporting SRAM, PSRAM, NOR and NAND memories
86- Rich analog peripherals (independent supply)
87
88        - 1x 12-bit ADC 1.14 MSPS
89        - 2x 12-bit DAC
90        - 2x ultra-low-power comparators
91- 11x communication interfaces
92
93        - USB 2.0 full-speed device, LPM and BCD
94        - 3x I2C FM+(1 Mbit/s), SMBus/PMBus
95        - 4x USARTs (ISO 7816, LIN, IrDA, modem)
96        - 6x SPIs (4x SPIs with the Quad SPI)
97- 7-channel DMA controller
98- True random number generator
99- CRC calculation unit, 96-bit unique ID
100- Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell*
101
102
103More information about STM32L072CZ can be found here:
104
105- `STM32L072CZ on www.st.com`_
106- `STM32L0x2 reference manual`_
107
108Supported Features
109==================
110
111The Zephyr B-L072Z-LRWAN1 Discovery board configuration supports the following hardware features:
112
113+-----------+------------+-------------------------------------+
114| Interface | Controller | Driver/Component                    |
115+===========+============+=====================================+
116| UART      | on-chip    | serial port-polling;                |
117|           |            | serial port-interrupt               |
118+-----------+------------+-------------------------------------+
119| PINMUX    | on-chip    | pinmux                              |
120+-----------+------------+-------------------------------------+
121| I2C       | on-chip    | i2c                                 |
122+-----------+------------+-------------------------------------+
123| SPI       | on-chip    | spi                                 |
124+-----------+------------+-------------------------------------+
125| GPIO      | on-chip    | gpio                                |
126+-----------+------------+-------------------------------------+
127| RTC       | on-chip    | counter                             |
128+-----------+------------+-------------------------------------+
129| TRNG      | on-chip    | true random number generator        |
130+-----------+------------+-------------------------------------+
131| EEPROM    | on-chip    | eeprom                              |
132+-----------+------------+-------------------------------------+
133| USB       | on-chip    | usb                                 |
134+-----------+------------+-------------------------------------+
135| FLASH     | on-chip    | flash                               |
136+-----------+------------+-------------------------------------+
137| LoRa      | on-module  | sx1276                              |
138+-----------+------------+-------------------------------------+
139
140Other hardware features are not yet supported on this Zephyr port.
141
142The default configuration can be found in the defconfig file:
143:zephyr_file:`boards/st/b_l072z_lrwan1/b_l072z_lrwan1_defconfig`
144
145
146Connections and IOs
147===================
148
149B-L072Z-LRWAN1 Discovery kit has GPIO controllers. These controllers are responsible for pin muxing,
150input/output, pull-up, etc.
151
152Available pins:
153---------------
154
155For detailed information about available pins please refer to `B-L072Z-LRWAN1 website`_.
156
157Default Zephyr Peripheral Mapping:
158----------------------------------
159
160- UART_1_TX/RX: PA9/PA10 (Arduino Serial)
161- UART_2_TX/RX: PA2/PA3 (ST-Link Virtual COM Port)
162- SPI1 NSS/SCK/MISO/MOSI: PA15/PB3/PA6/PA7 (Semtech SX1276 LoRa* Transceiver)
163- SPI2 NSS/SCK/MISO/MOSI: PB12/PB13/PB14/PB15 (Arduino SPI)
164- I2C1 SCL/SDA : PB8/PB9 (Arduino I2C)
165
166System Clock
167------------
168
169B-L072Z-LRWAN1 Discovery board System Clock is at 32MHz.
170
171Serial Port
172-----------
173
174B-L072Z-LRWAN1 Discovery board has 2 U(S)ARTs. The Zephyr console output is assigned to UART2.
175Default settings are 115200 8N1.
176
177USB device
178----------
179
180B-L072Z-LRWAN1 Discovery board has 1 USB device controller. However,
181the USB data lines are not connected to the MCU by default. To connect
182the USB data lines to the MCU, short solder bridges SB15 and SB16.
183
184Programming and Debugging
185*************************
186
187B-L072Z-LRWAN1 Discovery board includes an ST-LINK/V2-1 embedded debug tool interface.
188
189Applications for the ``b_l072z_lrwan1`` board configuration can be built and
190flashed in the usual way (see :ref:`build_an_application` and
191:ref:`application_run` for more details).
192
193Flashing
194========
195
196The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
197so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
198
199Alternatively, OpenOCD or JLink can also be used to flash the board using
200the ``--runner`` (or ``-r``) option:
201
202.. code-block:: console
203
204   $ west flash --runner openocd
205   $ west flash --runner jlink
206
207Flashing an application to B-L072Z-LRWAN1 Discovery board
208---------------------------------------------------------
209
210Here is an example for the :zephyr:code-sample:`hello_world` application.
211
212Connect the B-L072Z-LRWAN1 Discovery board to a STLinkV2 to your host computer using the USB port, then
213run a serial host program to connect with your board. For example:
214
215.. code-block:: console
216
217   $ minicom -D /dev/ttyACM0
218
219Then build and flash the application:
220
221.. zephyr-app-commands::
222   :zephyr-app: samples/hello_world
223   :board: b_l072z_lrwan1
224   :goals: build flash
225
226You should see the following message on the console:
227
228.. code-block:: console
229
230   $ Hello World! arm
231
232Debugging
233=========
234
235You can debug an application in the usual way.  Here is an example for the
236:zephyr:code-sample:`hello_world` application.
237
238.. zephyr-app-commands::
239   :zephyr-app: samples/hello_world
240   :board: b_l072z_lrwan1
241   :maybe-skip-config:
242   :goals: debug
243
244.. _B-L072Z-LRWAN1 website:
245   https://www.st.com/en/evaluation-tools/b-l072z-lrwan1.html
246
247.. _STM32L072CZ on www.st.com:
248   https://www.st.com/en/microcontrollers/stm32l072cz.html
249
250.. _STM32L0x2 reference manual:
251   https://www.st.com/resource/en/reference_manual/DM00108281.pdf
252
253.. _STM32CubeProgrammer:
254   https://www.st.com/en/development-tools/stm32cubeprog.html
255