1.. zephyr:board:: stm32g071b_disco
2
3Overview
4********
5The STM32G071B-DISCO Discovery board is a demonstration and development platform
6for the STMicroelectronics Arm® Cortex® -M0+ core-based STM32G071RB USB Type-C™
7and Power Delivery microcontroller. The STM32G071B-DISCO Discovery board is
8presented with all necessary interfaces for easy connection and
9interoperability with other USB Type-C™ devices. The STM32G071B-DISCO Discovery
10board is intended for discovery and display of USB Type-C™ port characteristics
11such as data role, power role, VBUS and IBUS monitoring. It offers an advanced
12user mode when associated with the STM32CubeMonUCPD software GUI and can be used
13as a USB Type-C™ and Power Delivery analyzer.
14
15- STM32G071RBT6 microcontroller featuring 128 Kbytes of Flash memory and
16  32 Kbytes of RAM in LQFP64 package
17- Plastic case
18- 1” 128 x 64 pixels OLED LCD module with SPI interface
19- USB Type-C™ interface plug cable and receptacle connector accessible by door
20  with reed sensor detection
21- 3 bidirectional current and power monitors with I2C interface to measure VBUS,
22  CC1 and CC2 protected and isolated lines
23- On-board DC/DC converter to sustain power supply with VBUS varying from 3 V to
24  20 V (+/- 5 %)
25- 4 user status LEDs about USB Type-C™ configuration
26- 3 LEDs for power and ST-LINK communication
27- 4-way joystick with selection button
28- 1 reset push-button
29- Board external connectors:
30    - USB Type-C™ plug cable
31    - USB Type-C™ receptacle connector
32    - 8-pin user extension connector including ADC, SPI, USART and
33      I2C communication signals
34    - USB with Micro-AB (ST-LINK)
35- Board internal connectors:
36    - 2 x 8-pin GPIOs free pins from microcontroller
37	  (accessible internally when case is removed)
38    - USB Type-C™ test points for main signals
39- Flexible power-supply options: ST-LINK USB VBUS or USB Type-C™ VBUS
40- On-board ST-LINK/V2-1 debugger/programmer with USB enumeration capability:
41  mass storage, Virtual COM port and debug port
42
43More information about the board can be found at the `STM32G071B-DISCO website`_.
44
45
46More information about STM32G071RB can be found here:
47
48- `G071RB on www.st.com`_
49- `STM32G071 reference manual`_
50
51
52Supported Features
53==================
54
55The Zephyr stm32g071b_disco board configuration supports the following hardware features:
56
57+-----------+------------+-------------------------------------+
58| Interface | Controller | Driver/Component                    |
59+===========+============+=====================================+
60| NVIC      | on-chip    | nested vector interrupt controller  |
61+-----------+------------+-------------------------------------+
62| UART      | on-chip    | serial port-polling;                |
63|           |            | serial port-interrupt               |
64+-----------+------------+-------------------------------------+
65| I2C       | on-chip    | i2c                                 |
66+-----------+------------+-------------------------------------+
67| UCPD      | on-chip    | ucpd                                |
68+-----------+------------+-------------------------------------+
69| GPIO      | on-chip    | gpio                                |
70+-----------+------------+-------------------------------------+
71| WATCHDOG  | on-chip    | independent watchdog                |
72+-----------+------------+-------------------------------------+
73
74Other hardware features are not yet supported in this Zephyr port.
75
76The default configuration can be found in the defconfig file:
77:zephyr_file:`boards/st/stm32g071b_disco/stm32g071b_disco_defconfig`
78
79Connections and IOs
80===================
81
82Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
83input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
84GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
85capable except for analog inputs.
86
87Default Zephyr Peripheral Mapping:
88----------------------------------
89
90- UART_3 TX/RX       : PC10/PC11 (ST-Link Virtual Port Com)
91- UCPD1              : PA8/PB15
92- BUTTON (JOY_SEL)   : PC0
93- BUTTON (JOY_LEFT)  : PC1
94- BUTTON (JOY_DOWN)  : PC2
95- BUTTON (JOY_RIGHT) : PC3
96- BUTTON (JOY_UP)    : PC4
97- LED (TO_REC)       : PD9
98- LED (TO_PLUG)      : PD8
99- LED (SINK_SPY)     : PD5
100- LED (SOURCE)       : PC12
101- ENCC1              : PB10 (Enable CC1)
102- ENCC2              : PB11 (Enable CC2)
103- RDCC1              : PB12 (Enable Door Sense on CC1)
104
105
106For more details please refer to `STM32G0 Discovery board User Manual`_.
107
108Programming and Debugging
109*************************
110
111The STM32G071B Discovery board includes an ST-LINK/V2-1 embedded debug tool interface.
112
113Applications for the ``stm32g071b_disco`` board configuration can be built and
114flashed in the usual way (see :ref:`build_an_application` and
115:ref:`application_run` for more details).
116
117Flashing
118========
119
120The board is configured to be flashed using west `STM32CubeProgrammer`_ runner,
121so its :ref:`installation <stm32cubeprog-flash-host-tools>` is required.
122
123.. code-block:: console
124
125   $ west flash
126
127Flashing an application to the STM32G071B_DISCO
128-----------------------------------------------
129
130Here is an example for the :zephyr:code-sample:`blinky` application.
131
132.. zephyr-app-commands::
133   :zephyr-app: samples/basic/blinky
134   :board: stm32g071b_disco
135   :goals: build flash
136
137You will see the LED blinking every second.
138
139Debugging
140=========
141
142You can debug an application in the usual way.  Here is an example for the
143:zephyr:code-sample:`hello_world` application.
144
145.. zephyr-app-commands::
146   :zephyr-app: samples/hello_world
147   :board: stm32g071b_disco
148   :maybe-skip-config:
149   :goals: debug
150
151References
152**********
153
154.. target-notes::
155
156.. _STM32G071B-DISCO website:
157   https://www.st.com/en/evaluation-tools/stm32g071b-disco.html
158
159.. _STM32G071 reference manual:
160   https://www.st.com/resource/en/reference_manual/dm00371828.pdf
161
162.. _STM32G0 Discovery board User Manual:
163   https://www.st.com/resource/en/user_manual/dm00496511.pdf
164
165.. _G071RB on www.st.com:
166   https://www.st.com/en/microcontrollers/stm32g071rb.html
167
168.. _STM32CubeProgrammer:
169   https://www.st.com/en/development-tools/stm32cubeprog.html
170