boards: arm: add support for STM32G071B Discovery board
Support the ST STM32G071B Discovery board with STM32G071RBTX SoC Tested with: - `samples/basic/blinky` - `samples/basic/button` Flashed samples via On-Board ST-LINK with: - west flash Signed-off-by: Sam Hurst <sbh1187@gmail.com>
This commit is contained in:
parent
be5a3777ca
commit
0f19812ce0
8 changed files with 329 additions and 0 deletions
8
boards/arm/stm32g071b_disco/Kconfig.board
Normal file
8
boards/arm/stm32g071b_disco/Kconfig.board
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# STM32G071B Discovery board configuration
|
||||||
|
|
||||||
|
# Copyright 2021 The Chromium OS Authors
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config BOARD_STM32G071B_DISCO
|
||||||
|
bool "STM32G071B Discovery Board"
|
||||||
|
depends on SOC_STM32G071XX
|
11
boards/arm/stm32g071b_disco/Kconfig.defconfig
Normal file
11
boards/arm/stm32g071b_disco/Kconfig.defconfig
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# STM32G071B Discovery board configuration
|
||||||
|
|
||||||
|
# Copyright 2021 The Chromium OS Authors
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
if BOARD_STM32G071B_DISCO
|
||||||
|
|
||||||
|
config BOARD
|
||||||
|
default "stm32g071b_disco"
|
||||||
|
|
||||||
|
endif # BOARD_STM32G071B_DISCO
|
6
boards/arm/stm32g071b_disco/board.cmake
Normal file
6
boards/arm/stm32g071b_disco/board.cmake
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset=hw")
|
||||||
|
|
||||||
|
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
|
||||||
|
|
BIN
boards/arm/stm32g071b_disco/doc/img/stm32g071b_disco.jpg
Normal file
BIN
boards/arm/stm32g071b_disco/doc/img/stm32g071b_disco.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
162
boards/arm/stm32g071b_disco/doc/index.rst
Normal file
162
boards/arm/stm32g071b_disco/doc/index.rst
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
.. _stm32g071b_disco_board:
|
||||||
|
|
||||||
|
ST STM32G071B Discovery
|
||||||
|
#######################
|
||||||
|
|
||||||
|
Overview
|
||||||
|
********
|
||||||
|
The STM32G071B-DISCO Discovery board is a demonstration and development platform
|
||||||
|
for the STMicroelectronics Arm® Cortex® -M0+ core-based STM32G071RB USB Type-C™
|
||||||
|
and Power Delivery microcontroller. The STM32G071B-DISCO Discovery board is
|
||||||
|
presented with all necessary interfaces for easy connection and
|
||||||
|
interoperability with other USB Type-C™ devices. The STM32G071B-DISCO Discovery
|
||||||
|
board is intended for discovery and display of USB Type-C™ port characteristics
|
||||||
|
such as data role, power role, VBUS and IBUS monitoring. It offers an advanced
|
||||||
|
user mode when associated with the STM32CubeMonUCPD software GUI and can be used
|
||||||
|
as a USB Type-C™ and Power Delivery analyzer.
|
||||||
|
|
||||||
|
- STM32G071RBT6 microcontroller featuring 128 Kbytes of Flash memory and
|
||||||
|
32 Kbytes of RAM in LQFP64 package
|
||||||
|
- Plastic case
|
||||||
|
- 1” 128 x 64 pixels OLED LCD module with SPI interface
|
||||||
|
- USB Type-C™ interface plug cable and receptacle connector accessible by door
|
||||||
|
with reed sensor detection
|
||||||
|
- 3 bidirectional current and power monitors with I2C interface to measure VBUS,
|
||||||
|
CC1 and CC2 protected and isolated lines
|
||||||
|
- On-board DC/DC converter to sustain power supply with VBUS varying from 3 V to
|
||||||
|
20 V (+/- 5 %)
|
||||||
|
- 4 user status LEDs about USB Type-C™ configuration
|
||||||
|
- 3 LEDs for power and ST-LINK communication
|
||||||
|
- 4-way joystick with selection button
|
||||||
|
- 1 reset push-button
|
||||||
|
- Board external connectors:
|
||||||
|
- USB Type-C™ plug cable
|
||||||
|
- USB Type-C™ receptacle connector
|
||||||
|
- 8-pin user extension connector including ADC, SPI, USART and
|
||||||
|
I2C communication signals
|
||||||
|
- USB with Micro-AB (ST-LINK)
|
||||||
|
- Board internal connectors:
|
||||||
|
- 2 x 8-pin GPIOs free pins from microcontroller
|
||||||
|
(accessible internally when case is removed)
|
||||||
|
- USB Type-C™ test points for main signals
|
||||||
|
- Flexible power-supply options: ST-LINK USB VBUS or USB Type-C™ VBUS
|
||||||
|
- On-board ST-LINK/V2-1 debugger/programmer with USB enumeration capability:
|
||||||
|
mass storage, Virtual COM port and debug port
|
||||||
|
|
||||||
|
.. image:: img/stm32g071b_disco.jpg
|
||||||
|
:width: 500px
|
||||||
|
:height: 450px
|
||||||
|
:align: center
|
||||||
|
:alt: STM32G071B-DISCO
|
||||||
|
|
||||||
|
More information about the board can be found at the `STM32G071B-DISCO website`_.
|
||||||
|
|
||||||
|
|
||||||
|
More information about STM32G071RB can be found here:
|
||||||
|
- `G071RB on www.st.com`_
|
||||||
|
- `STM32G071 reference manual`_
|
||||||
|
|
||||||
|
|
||||||
|
Supported Features
|
||||||
|
==================
|
||||||
|
|
||||||
|
The Zephyr stm32g071b_disco board configuration supports the following hardware features:
|
||||||
|
|
||||||
|
+-----------+------------+-------------------------------------+
|
||||||
|
| Interface | Controller | Driver/Component |
|
||||||
|
+===========+============+=====================================+
|
||||||
|
| NVIC | on-chip | nested vector interrupt controller |
|
||||||
|
+-----------+------------+-------------------------------------+
|
||||||
|
| UART | on-chip | serial port-polling; |
|
||||||
|
| | | serial port-interrupt |
|
||||||
|
+-----------+------------+-------------------------------------+
|
||||||
|
| GPIO | on-chip | gpio |
|
||||||
|
+-----------+------------+-------------------------------------+
|
||||||
|
| WATCHDOG | on-chip | independent watchdog |
|
||||||
|
+-----------+------------+-------------------------------------+
|
||||||
|
|
||||||
|
Other hardware features are not yet supported in this Zephyr port.
|
||||||
|
|
||||||
|
The default configuration can be found in the defconfig file:
|
||||||
|
``boards/arm/stm32g071b_disco/stm32g071b_disco_defconfig``
|
||||||
|
|
||||||
|
Connections and IOs
|
||||||
|
===================
|
||||||
|
|
||||||
|
Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
|
||||||
|
input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
|
||||||
|
GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
|
||||||
|
capable except for analog inputs.
|
||||||
|
|
||||||
|
Default Zephyr Peripheral Mapping:
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
- UART_3 TX/RX : PC10/PC11 (ST-Link Virtual Port Com)
|
||||||
|
- BUTTON (JOY_SEL) : PC0
|
||||||
|
- BUTTON (JOY_LEFT) : PC1
|
||||||
|
- BUTTON (JOY_DOWN) : PC2
|
||||||
|
- BUTTON (JOY_RIGHT) : PC3
|
||||||
|
- BUTTON (JOY_UP) : PC4
|
||||||
|
- LED (TO_REC) : PD9
|
||||||
|
- LED (TO_PLUG) : PD8
|
||||||
|
- LED (SINK_SPY) : PD5
|
||||||
|
- LED (SOURCE) : PC12
|
||||||
|
|
||||||
|
For mode details please refer to `STM32G0 Discovery board User Manual`_.
|
||||||
|
|
||||||
|
Programming and Debugging
|
||||||
|
*************************
|
||||||
|
|
||||||
|
Applications for the ``stm32g071b_disco`` board configuration can be built and
|
||||||
|
flashed in the usual way (see :ref:`build_an_application` and
|
||||||
|
:ref:`application_run` for more details).
|
||||||
|
|
||||||
|
Flashing
|
||||||
|
========
|
||||||
|
|
||||||
|
The STM32G071B Discovery board includes an ST-LINK/V2-1 embedded debug tool interface.
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ west flash
|
||||||
|
|
||||||
|
Flashing an application to the STM32G071B_DISCO
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
Here is an example for the :ref:`blinky-sample` application.
|
||||||
|
|
||||||
|
.. zephyr-app-commands::
|
||||||
|
:zephyr-app: samples/basic/blinky
|
||||||
|
:board: stm32g071b_disco
|
||||||
|
:goals: build flash
|
||||||
|
|
||||||
|
You will see the LED blinking every second.
|
||||||
|
|
||||||
|
Debugging
|
||||||
|
=========
|
||||||
|
|
||||||
|
You can debug an application in the usual way. Here is an example for the
|
||||||
|
:ref:`hello_world` application.
|
||||||
|
|
||||||
|
.. zephyr-app-commands::
|
||||||
|
:zephyr-app: samples/hello_world
|
||||||
|
:board: stm32g071b_disco
|
||||||
|
:maybe-skip-config:
|
||||||
|
:goals: debug
|
||||||
|
|
||||||
|
References
|
||||||
|
**********
|
||||||
|
|
||||||
|
.. target-notes::
|
||||||
|
|
||||||
|
.. _STM32G071B-DISCO website:
|
||||||
|
https://www.st.com/en/evaluation-tools/stm32g071b-disco.html
|
||||||
|
|
||||||
|
.. _STM32G071 reference manual:
|
||||||
|
http://www.st.com/resource/en/reference_manual/dm00371828.pdf
|
||||||
|
|
||||||
|
.. _STM32G0 Discovery board User Manual:
|
||||||
|
https://www.st.com/resource/en/user_manual/dm00496511.pdf
|
||||||
|
|
||||||
|
.. _G071RB on www.st.com:
|
||||||
|
http://www.st.com/en/microcontrollers/stm32g071rb.html
|
87
boards/arm/stm32g071b_disco/stm32g071b_disco.dts
Normal file
87
boards/arm/stm32g071b_disco/stm32g071b_disco.dts
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2021 The Chromium OS Authors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
#include <st/g0/stm32g071Xb.dtsi>
|
||||||
|
#include <st/g0/stm32g071r(6-8-b)tx-pinctrl.dtsi>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "STM32G071B DEMO board";
|
||||||
|
compatible = "st,stm32g071-demo";
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
zephyr,console = &usart3;
|
||||||
|
zephyr,shell-uart = &usart3;
|
||||||
|
zephyr,sram = &sram0;
|
||||||
|
zephyr,flash = &flash0;
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
red_led_4: led4 {
|
||||||
|
gpios = <&gpiod 9 GPIO_ACTIVE_HIGH>;
|
||||||
|
label = "TO_REC";
|
||||||
|
};
|
||||||
|
red_led_5: led5 {
|
||||||
|
gpios = <&gpiod 8 GPIO_ACTIVE_HIGH>;
|
||||||
|
label = "TO_PLUG";
|
||||||
|
};
|
||||||
|
green_led_6: led6 {
|
||||||
|
gpios = <&gpiod 5 GPIO_ACTIVE_HIGH>;
|
||||||
|
label = "SINK_SPY";
|
||||||
|
};
|
||||||
|
green_led_7: led7 {
|
||||||
|
gpios = <&gpioc 12 GPIO_ACTIVE_HIGH>;
|
||||||
|
label = "SOURCE";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_keys {
|
||||||
|
compatible = "gpio-keys";
|
||||||
|
joy_sel: button0 {
|
||||||
|
label = "JOY_SEL";
|
||||||
|
gpios = <&gpioc 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
|
||||||
|
};
|
||||||
|
joy_left: button1 {
|
||||||
|
label = "JOY_LEFT";
|
||||||
|
gpios = <&gpioc 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
|
||||||
|
};
|
||||||
|
joy_down: button2 {
|
||||||
|
label = "JOY_DOWN";
|
||||||
|
gpios = <&gpioc 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
|
||||||
|
};
|
||||||
|
joy_right: button3 {
|
||||||
|
label = "JOY_RIGHT";
|
||||||
|
gpios = <&gpioc 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
|
||||||
|
};
|
||||||
|
joy_up: button4 {
|
||||||
|
label = "JOY_UP";
|
||||||
|
gpios = <&gpioc 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
led0 = &red_led_4;
|
||||||
|
led1 = &red_led_5;
|
||||||
|
led2 = &green_led_6;
|
||||||
|
led3 = &green_led_7;
|
||||||
|
sw0 = &joy_sel;
|
||||||
|
sw1 = &joy_left;
|
||||||
|
sw2 = &joy_down;
|
||||||
|
sw3 = &joy_right;
|
||||||
|
sw4 = &joy_up;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&usart3 {
|
||||||
|
pinctrl-0 = <&usart3_tx_pc10 &usart3_rx_pc11>;
|
||||||
|
current-speed = <115200>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&iwdg {
|
||||||
|
status = "okay";
|
||||||
|
};
|
14
boards/arm/stm32g071b_disco/stm32g071b_disco.yaml
Normal file
14
boards/arm/stm32g071b_disco/stm32g071b_disco.yaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
identifier: stm32g071b_disco
|
||||||
|
name: ST STM32G071B Discovery
|
||||||
|
type: mcu
|
||||||
|
arch: arm
|
||||||
|
toolchain:
|
||||||
|
- zephyr
|
||||||
|
- gnuarmemb
|
||||||
|
- xtools
|
||||||
|
ram: 36
|
||||||
|
flash: 128
|
||||||
|
supported:
|
||||||
|
- uart
|
||||||
|
- gpio
|
||||||
|
- watchdog
|
41
boards/arm/stm32g071b_disco/stm32g071b_disco_defconfig
Normal file
41
boards/arm/stm32g071b_disco/stm32g071b_disco_defconfig
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# Copyright 2021 The Chromium OS Authors
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
CONFIG_SOC_SERIES_STM32G0X=y
|
||||||
|
CONFIG_SOC_STM32G071XX=y
|
||||||
|
|
||||||
|
# 64MHz system clock
|
||||||
|
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=64000000
|
||||||
|
|
||||||
|
# Serial Drivers
|
||||||
|
CONFIG_SERIAL=y
|
||||||
|
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||||
|
|
||||||
|
# enable console
|
||||||
|
CONFIG_CONSOLE=y
|
||||||
|
CONFIG_UART_CONSOLE=y
|
||||||
|
|
||||||
|
# Pinmux Driver
|
||||||
|
CONFIG_PINMUX=y
|
||||||
|
|
||||||
|
# GPIO Controller
|
||||||
|
CONFIG_GPIO=y
|
||||||
|
|
||||||
|
# Clock configuration
|
||||||
|
CONFIG_CLOCK_CONTROL=y
|
||||||
|
|
||||||
|
# SYSCLK selection
|
||||||
|
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
|
||||||
|
|
||||||
|
# PLL configuration
|
||||||
|
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
|
||||||
|
|
||||||
|
# produce 64MHz clock at PLL output
|
||||||
|
CONFIG_CLOCK_STM32_PLL_M_DIVISOR=1
|
||||||
|
CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=8
|
||||||
|
CONFIG_CLOCK_STM32_PLL_P_DIVISOR=2
|
||||||
|
CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=2
|
||||||
|
CONFIG_CLOCK_STM32_PLL_R_DIVISOR=2
|
||||||
|
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
|
||||||
|
CONFIG_CLOCK_STM32_APB1_PRESCALER=1
|
Loading…
Add table
Add a link
Reference in a new issue