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