diff --git a/boards/arm/stm32g081b_eval/Kconfig.board b/boards/arm/stm32g081b_eval/Kconfig.board new file mode 100644 index 00000000000..2f2299670f5 --- /dev/null +++ b/boards/arm/stm32g081b_eval/Kconfig.board @@ -0,0 +1,8 @@ +# STM32G081B Evaluation board configuration + +# Copyright 2021 The Chromium OS Authors +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_STM32G081B_EVAL + bool "STM32G081B Evaluation Board" + depends on SOC_STM32G081XX diff --git a/boards/arm/stm32g081b_eval/Kconfig.defconfig b/boards/arm/stm32g081b_eval/Kconfig.defconfig new file mode 100644 index 00000000000..548b4d75cc1 --- /dev/null +++ b/boards/arm/stm32g081b_eval/Kconfig.defconfig @@ -0,0 +1,11 @@ +# STM32G081B evaluation board configuration + +# Copyright 2021 The Chromium OS Authors +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_STM32G081B_EVAL + +config BOARD + default "stm32g081b_eval" + +endif # BOARD_STM32G081B_EVAL diff --git a/boards/arm/stm32g081b_eval/board.cmake b/boards/arm/stm32g081b_eval/board.cmake new file mode 100644 index 00000000000..d140927a7fe --- /dev/null +++ b/boards/arm/stm32g081b_eval/board.cmake @@ -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) + diff --git a/boards/arm/stm32g081b_eval/doc/img/stm32g081b_eval.jpg b/boards/arm/stm32g081b_eval/doc/img/stm32g081b_eval.jpg new file mode 100644 index 00000000000..fb916e8e42f Binary files /dev/null and b/boards/arm/stm32g081b_eval/doc/img/stm32g081b_eval.jpg differ diff --git a/boards/arm/stm32g081b_eval/doc/index.rst b/boards/arm/stm32g081b_eval/doc/index.rst new file mode 100644 index 00000000000..7d9ffe452a5 --- /dev/null +++ b/boards/arm/stm32g081b_eval/doc/index.rst @@ -0,0 +1,203 @@ +.. _stm32g081b_eval_board: + +ST STM32G081B Evaluation +######################## + +Overview +******** +The STM32G081B-EVAL Evaluation board is a high-end development platform, for +Arm Cortex-M0+ core-based STM32G081RBT6 microcontroller, with USB Type-C and +power delivery controller interfaces (UCPD), compliant with USB type-C r1.2 +and USB PD specification r3.0, two I2Cs, two SPIs, five USARTs, one LP UART, +one 12-bit ADC, two 12-bit DACs, two GP comparators, two LP timers, internal +32 KB SRAM and 128 KB Flash, CEC, SWD debugging support. The full range of +hardware features on the STM32G081B-EVAL Evaluation board includes a mother +board, a legacy peripheral daughterboard and a USB-C and Power Delivery +daughterboard, which help to evaluate all peripherals (USB Type-C connector +with USB PD, motor control connector, RS232, RS485, Audio DAC, microphone ADC, +TFT LCD, IrDA, IR LED, IR receiver, LDR, MicroSD card, CEC on two HDMI +connectors, smart card slot, RF E2PROM & Temperature sensor…), and to develop +applications. + +The board integrates an ST-LINK/V2-1 as an embedded in-circuit debugger and +programmer for the STM32 MCU. The daughterboard and extension connectors +provide an easy way to connect a daughterboard or wrapping board for the +user's specific applications. + +The USB-C and Power Delivery daughterboard +features two independent USB-C ports controlled by an STM32G0. USB-C port 1 +is dual role power (DRP) and can provide up-to 45 W. USB-C Port 2 is sink +only. Both support USB PD protocol and alternate mode functionality. + +Application firmware examples are provided to evaluate the USB-C technology +through various use cases. + + + +- Mother board + - STM32G081RBT6 microcontroller with 128 Kbytes of Flash memory and + 32 Kbytes of RAM in LQFP64 package + - MCU voltage choice fixed 3.3 V or adjustable from 1.65 V to 3.6 V + - I2C compatible serial interface + - RTC with backup battery + - 8-Gbyte or more SPI interface microSD card + - Potentiometer + - 4 color user LEDs and one LED as MCU low-power alarm + - Reset, Tamper and User buttons + - 4-direction control and selection joystick + - Board connectors: + - 5 V power jack + - RS-232 and RS485 communications + - Stereo audio jack including analog microphone input + - microSD card + - Extension I2C connector + - Motor-control connector + - Board extension connectors: + - Daughterboard connectors for legacy peripheral daughter board or + USB-C daughterboard + - Extension connectors for daughterboard or wire-wrap board + - Flexible power-supply options: + - 5 V power jack + - ST-LINK/V2-1 USB connector + - Daughterboard + - On-board ST-LINK/V2-1 debugger/programmer with USB re-enumeration + capability: mass storage, virtual COM port and debug port + - Legacy peripheral daughterboard + - IrDA transceiver + - IR LED and IR receiver + - Light dependent resistor (LDR) + - Temperature Sensor + - Board connectors: + - Two HDMI connectors with DDC and CEC + - Smart card slot + - USB-C and Power Delivery daughterboard + - Mux for USB3.1 Gen1 / DisplayPort input and Type-C port1 output + - Mux for Type-C port2 input and DisplayPort output / USB2.0 + - VCONN on Type-C port1 + - USB PD on Type-C port1 + - Board connectors: + - Type-C port1 DRP (dual-role port) + - Type-C port2 Sink + - DisplayPort input + - DisplayPort output + - USB 3.1 Gen1 Type-B receptacle + - USB2.0 Type-A receptacle + - 19 V power jack for USB PD + +.. image:: img/stm32g081b_eval.jpg + :width: 426px + :height: 597px + :align: center + :alt: STM32G081B-EVAL + +More information about the board can be found at the `STM32G081B-EVAL website`_. + + +More information about STM32G081RB can be found here: +- `G081RB on www.st.com`_ +- `STM32G081 reference manual`_ + + +Supported Features +================== + +The Zephyr stm32g081b_eval 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/stm32g081b_eval/stm32g081b_eval_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) : PA0 +- BUTTON (JOY_LEFT) : PC8 +- BUTTON (JOY_DOWN) : PC3 +- BUTTON (JOY_RIGHT) : PC7 +- BUTTON (JOY_UP) : PC2 +- LED1 : PD5 +- LED2 : PD6 +- LED3 : PD8 +- LED4 : PD9 + +For mode details please refer to `STM32G0 Evaluation board User Manual`_. + +Programming and Debugging +************************* + +Applications for the ``stm32g081b_eval`` 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 STM32G081B Evaluation board includes an ST-LINK/V2-1 embedded debug tool interface. + +.. code-block:: console + + $ west flash + +Flashing an application to the STM32G081B_EVAL +---------------------------------------------- + +Here is an example for the :ref:`blinky-sample` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: stm32g081b_eval + :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: stm32g081b_eval + :maybe-skip-config: + :goals: debug + +References +********** + +.. target-notes:: + +.. _STM32G081B-EVAL website: + https://www.st.com/en/evaluation-tools/stm32g081b-eval.html + +.. _STM32G081 reference manual: + https://www.st.com/resource/en/reference_manual/rm0444-stm32g0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf + +.. _STM32G0 Evaluation board User Manual: + https://www.st.com/resource/en/user_manual/um2403-evaluation-board-with-stm32g081rb-mcu-stmicroelectronics.pdf + +.. _G081RB on www.st.com: + http://www.st.com/en/microcontrollers/stm32g081rb.html diff --git a/boards/arm/stm32g081b_eval/stm32g081b_eval.dts b/boards/arm/stm32g081b_eval/stm32g081b_eval.dts new file mode 100644 index 00000000000..5e0527aea95 --- /dev/null +++ b/boards/arm/stm32g081b_eval/stm32g081b_eval.dts @@ -0,0 +1,109 @@ +/* + * Copyright 2021 The Chromium OS Authors + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include + +/ { + model = "STM32G081B EVAL board"; + compatible = "st,stm32g081-eval"; + + chosen { + zephyr,console = &usart3; + zephyr,shell-uart = &usart3; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + led_1: led1 { + gpios = <&gpiod 5 GPIO_ACTIVE_HIGH>; + label = "LED1"; + }; + led_2: led2 { + gpios = <&gpiod 6 GPIO_ACTIVE_HIGH>; + label = "LED2"; + }; + led_3: led3 { + gpios = <&gpiod 8 GPIO_ACTIVE_HIGH>; + label = "LED3"; + }; + led_4: led4 { + gpios = <&gpiod 9 GPIO_ACTIVE_HIGH>; + label = "LED4"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + joy_sel: button0 { + label = "JOY_SEL"; + gpios = <&gpioa 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + }; + joy_left: button1 { + label = "JOY_LEFT"; + gpios = <&gpioc 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + }; + joy_down: button2 { + label = "JOY_DOWN"; + gpios = <&gpioc 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + }; + joy_right: button3 { + label = "JOY_RIGHT"; + gpios = <&gpioc 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + }; + joy_up: button4 { + label = "JOY_UP"; + gpios = <&gpioc 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; + }; + }; + + aliases { + led0 = &led_1; + led1 = &led_2; + led2 = &led_3; + led3 = &led_4; + sw0 = &joy_sel; + sw1 = &joy_left; + sw2 = &joy_down; + sw3 = &joy_right; + sw4 = &joy_up; + }; +}; + +&clk_hsi { + status = "okay"; +}; + +&pll { + div-m = <1>; + mul-n = <8>; + div-p = <2>; + div-q = <2>; + div-r = <2>; + clocks = <&clk_hsi>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <1>; +}; + +&usart3 { + pinctrl-0 = <&usart3_tx_pc10 &usart3_rx_pc11>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&iwdg { + status = "okay"; +}; diff --git a/boards/arm/stm32g081b_eval/stm32g081b_eval.yaml b/boards/arm/stm32g081b_eval/stm32g081b_eval.yaml new file mode 100644 index 00000000000..53f131e1c53 --- /dev/null +++ b/boards/arm/stm32g081b_eval/stm32g081b_eval.yaml @@ -0,0 +1,14 @@ +identifier: stm32g081b_eval +name: ST STM32G081B Evaluation +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 32 +flash: 128 +supported: + - uart + - gpio + - watchdog diff --git a/boards/arm/stm32g081b_eval/stm32g081b_eval_defconfig b/boards/arm/stm32g081b_eval/stm32g081b_eval_defconfig new file mode 100644 index 00000000000..cccb164bbcd --- /dev/null +++ b/boards/arm/stm32g081b_eval/stm32g081b_eval_defconfig @@ -0,0 +1,23 @@ +# Copyright 2021 The Chromium OS Authors +# +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_STM32G0X=y +CONFIG_SOC_STM32G081XX=y + +# Serial Drivers +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# GPIO Controller +CONFIG_GPIO=y + +# Enable Clocks +CONFIG_CLOCK_CONTROL=y + +# enable pin controller +CONFIG_PINCTRL=y