board: Google Twinkie V2

This is a new board for the google Twinkie V2 tool.

Signed-off-by: Jason Yuan <jasonyuan@google.com>
This commit is contained in:
Jason Yuan 2023-01-26 14:52:38 -08:00 committed by Carles Cufí
commit 8fb198bf01
7 changed files with 295 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# Copyright 2023 The ChromiumOS Authors
# SPDX-License-Identifier: Apache-2.0
config BOARD_GOOGLE_TWINKIE_V2
bool "Google Twinkie V2 Board"
depends on SOC_STM32G0B1XX

View file

@ -0,0 +1,9 @@
# Copyright 2023 The ChromiumOS Authors
# SPDX-License-Identifier: Apache-2.0
if BOARD_GOOGLE_TWINKIE_V2
config BOARD
default "google_twinkie_v2"
endif # BOARD_GOOGLE_TWINKIE_V2

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse")
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset=hw")
board_runner_args(jlink "--device=STM32G0B1RE" "--speed=4000")
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake)
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

View file

@ -0,0 +1,57 @@
.. _google_twinkie_v2_board:
Google Twinkie V2
#################
Overview
********
Google Twinkie V2 is a reference board for the google power delivery analyzer
(PDA) Twinkie V2.
Hardware
********
- STM32G0B1REI6
Supported Features
==================
The following features are supported:
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| CLOCK | on-chip | reset and clock control |
+-----------+------------+-------------------------------------+
| FLASH | on-chip | flash memory |
+-----------+------------+-------------------------------------+
The default configuration can be found in the defconfig file:
``boards/arm/google_twinkie_v2/google_twinkie_v2_defconfig``
Pin Mapping
===========
Default Zephyr Peripheral Mapping:
----------------------------------
- CC1_BUF : PA1
- CC2_BUF : PA3
- VBUS_READ_BUF : PB11
- CSA_VBUS : PC4
- CSA_CC2 : PC5
Programming and Debugging
*************************
Build application as usual for the ``google_twinkie_v2`` board, and flash
using dfu-util or J-Link.
Debugging
=========
Use SWD with a J-Link or ST-Link.

View file

@ -0,0 +1,182 @@
/*
* Copyright 2023 The ChromiumOS Authors
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/g0/stm32g0b1Xe.dtsi>
#include <st/g0/stm32g0b1r(b-c-e)ixn-pinctrl.dtsi>
/ {
model = "Google Twinkie V2";
compatible = "google,twinkie-v2";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
leds {
compatible = "gpio-leds";
red_led_0: led0 {
gpios = <&gpioc 8 GPIO_ACTIVE_LOW>;
};
green_led_1: led1 {
gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
};
blue_led_2: led2 {
gpios = <&gpiob 7 GPIO_ACTIVE_LOW>;
};
};
gpio_keys {
compatible = "gpio-keys";
/* does not go to an actual button in current hardware.
* short TP5 to TP6 to activate.
*/
dfu_detect: dfudetect {
gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};
};
cc1_buf: cc1buf {
compatible = "voltage-divider";
io-channels = <&adc1 1>;
output-ohms = <2000000000>;
};
cc2_buf: cc2buf {
compatible = "voltage-divider";
io-channels = <&adc1 3>;
output-ohms = <2000000000>;
};
vbus_read_buf: vbusv {
compatible = "voltage-divider";
io-channels = <&adc1 15>;
output-ohms = <68000>;
full-ohms = <(2000000 + 68000)>;
};
csa_vbus: vbusc {
compatible = "current-sense-amplifier";
io-channels = <&adc1 17>;
sense-resistor-micro-ohms = <3000>;
sense-gain-mult = <100>;
};
csa_cc2: vconc {
compatible = "current-sense-amplifier";
io-channels = <&adc1 18>;
sense-resistor-micro-ohms = <10000>;
sense-gain-mult = <25>;
};
aliases {
led0 = &red_led_0;
led1 = &green_led_1;
led2 = &blue_led_2;
bootloader-led0 = &blue_led_2;
vcc1 = &cc1_buf;
vcc2 = &cc2_buf;
vbus = &vbus_read_buf;
cbus = &csa_vbus;
ccon = &csa_cc2;
};
};
&adc1 {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&adc1_in1_pa1 /* CC1_BUF */
&adc1_in3_pa3 /* CC2_BUF */
&adc1_in15_pb11 /* VBUS_READ_BUF */
&adc1_in17_pc4 /* CSA_VBUS */
&adc1_in18_pc5 /* CSA_CC2 */
>;
pinctrl-names = "default";
status = "okay";
channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
channel@3 {
reg = <3>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
channel@15 {
reg = <15>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
channel@17 {
reg = <17>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
channel@18 {
reg = <18>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
&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 = <DT_FREQ_M(64)>;
ahb-prescaler = <1>;
apb1-prescaler = <1>;
};
&iwdg {
status = "okay";
};
&ucpd1 {
status = "okay";
psc-ucpdclk = <1>;
hbitclkdiv = <27>;
pinctrl-0 = <&ucpd1_cc1_pa8 &ucpd1_cc2_pb15>;
pinctrl-names = "default";
};

View file

@ -0,0 +1,14 @@
identifier: google_twinkie_v2
name: Google Twinkie V2
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 144
flash: 512
testing:
ignore_tags:
- net
- bluetooth

View file

@ -0,0 +1,18 @@
# Copyright 2023 The ChromiumOS Authors
#
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_STM32G0X=y
CONFIG_SOC_STM32G0B1XX=y
# GPIO Controller
CONFIG_GPIO=y
# Enable Clocks
CONFIG_CLOCK_CONTROL=y
# enable pin controller
CONFIG_PINCTRL=y
# Enable MPU
CONFIG_ARM_MPU=y