-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a new board for the google Twinkie V2 tool. Signed-off-by: Jason Yuan <[email protected]>
- Loading branch information
1 parent
e55fd53
commit 5907627
Showing
7 changed files
with
268 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") | ||
|
||
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
/* | ||
* 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; | ||
zephyr,shell_uart = &cdc_acm_uart0; | ||
zephyr,console = &cdc_acm_uart1; | ||
}; | ||
|
||
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>; | ||
}; | ||
}; | ||
|
||
cc_config { | ||
compatible = "gpio-leds"; | ||
cc1_en: cc1en { | ||
gpios = <&gpiob 2 GPIO_ACTIVE_HIGH>; | ||
}; | ||
|
||
cc2_en: cc2en { | ||
gpios = <&gpiob 13 GPIO_ACTIVE_HIGH>; | ||
}; | ||
}; | ||
|
||
gpio_keys { | ||
compatible = "gpio-keys"; | ||
dfu_detect: dfudetect { | ||
gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; | ||
}; | ||
}; | ||
|
||
cc1_buf: cc1buf { | ||
compatible = "voltage-divider"; | ||
io-channels = <&adc1 1>; | ||
output-ohms = <0>; | ||
}; | ||
|
||
cc2_buf: cc2buf { | ||
compatible = "voltage-divider"; | ||
io-channels = <&adc1 3>; | ||
output-ohms = <0>; | ||
}; | ||
|
||
vbus_v: vbusv { | ||
compatible = "voltage-divider"; | ||
io-channels = <&adc1 15>; | ||
output-ohms = <68000>; | ||
full-ohms = <(2000000 + 68000)>; | ||
}; | ||
|
||
vbus_c: vbusc { | ||
compatible = "shunt-sensor"; | ||
io-channels = <&adc1 17>; | ||
shunt-resistor-mohms = <3>; | ||
gain = <100>; | ||
label = "VBUS_C"; | ||
}; | ||
|
||
vcon_c: vconc { | ||
compatible = "shunt-sensor"; | ||
io-channels = <&adc1 18>; | ||
shunt-resistor-mohms = <10>; | ||
gain = <25>; | ||
label = "VCON_C"; | ||
}; | ||
|
||
|
||
aliases { | ||
led0 = &red_led_0; | ||
led1 = &green_led_1; | ||
led2 = &blue_led_2; | ||
bootloader-led0 = &blue_led_2; | ||
encc1 = &cc1_en; | ||
encc2 = &cc2_en; | ||
vcc1 = &cc1_buf; | ||
vcc2 = &cc2_buf; | ||
vbus = &vbus_v; | ||
cbus = &vbus_c; | ||
ccon = &vcon_c; | ||
}; | ||
}; | ||
|
||
|
||
&adc1 { | ||
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"; | ||
}; | ||
|
||
&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"; | ||
|
||
/* | ||
* UCPD is fed directly from HSI which is @ 16MHz. The ucpd_clk goes to | ||
* a prescaler who's output feeds the 'half-bit' divider which is used | ||
* to generate clock for delay counters and BMC Rx/Tx blocks. The rx is | ||
* designed to work in freq ranges of 6 <--> 18 MHz, however recommended | ||
* range is 9 <--> 18 MHz. | ||
* | ||
* +-------+ @ 16 MHz +-------+ @ ~600 kHz +-----------+ | ||
* HSI ---->| /psc |--------->| /hbit |--------------->| trans_cnt | | ||
* +-------+ +-------+ | +-----------+ | ||
* | +-----------+ | ||
* +----------->| ifrgap_cnt| | ||
* +-----------+ | ||
* Requirements: | ||
* 1. hbit_clk ~= 600 kHz: 16 MHz / 600 kHz = 26.67 | ||
* 2. tTransitionWindow - 12 to 20 uSec | ||
* 3. tInterframGap - uSec | ||
* | ||
* hbit_clk = HSI_clk / 27 = 592.6 kHz = 1.687 uSec period | ||
* tTransitionWindow = 1.687 uS * 8 = 13.5 uS | ||
* tInterFrameGap = 1.687 uS * 17 = 28.68 uS | ||
*/ | ||
psc-ucpdclk = <1>; | ||
hbitclkdiv = <27>; | ||
pinctrl-names = "default"; | ||
pinctrl-0 = <&ucpd1_cc1_pa8 &ucpd1_cc2_pb15>; | ||
}; | ||
|
||
zephyr_udc0: &usb { | ||
/* Twinkie V2 Command Shell */ | ||
cdc_acm_uart0: cdc_acm_uart0 { | ||
compatible = "zephyr,cdc-acm-uart"; | ||
}; | ||
|
||
/* Twinkie V2 Packet Logging */ | ||
cdc_acm_uart1: cdc_acm_uart1 { | ||
compatible = "zephyr,cdc-acm-uart"; | ||
}; | ||
|
||
pinctrl-names = "default"; | ||
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; | ||
status = "okay"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
identifier: google_twinkie_v2 | ||
name: Goolge Twinkie PD Snooper | ||
type: mcu | ||
arch: arm | ||
toolchain: | ||
- zephyr | ||
- gnuarmemb | ||
- xtools | ||
ram: 36 | ||
flash: 128 | ||
testing: | ||
ignore_tags: | ||
- net | ||
- bluetooth | ||
- shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2023 The ChromiumOS Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
description: | | ||
Description for a current sensor measured using a shunt resistor and | ||
parallel voltmeter. | ||
compatible: "shunt-sensor" | ||
|
||
include: base.yaml | ||
|
||
properties: | ||
io-channels: | ||
required: true | ||
description: | | ||
Channels available with this divider configuration. | ||
shunt-resistor-mohms: | ||
type: int | ||
required: true | ||
description: | | ||
Resistance of the shunt resistor in milli-ohms | ||
gain: | ||
type: int | ||
default: 1 | ||
description: | | ||
Gain used to amplify the voltage measured across the shunt resistor. |