| /* |
| * 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> |
| #include <zephyr/dt-bindings/sensor/ina230.h> |
| #include <zephyr/dt-bindings/input/input-event-codes.h> |
| |
| / { |
| 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)>; |
| zephyr,code = <INPUT_KEY_ENTER>; |
| }; |
| joy_left: button1 { |
| label = "JOY_LEFT"; |
| gpios = <&gpioc 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; |
| zephyr,code = <INPUT_KEY_LEFT>; |
| }; |
| joy_down: button2 { |
| label = "JOY_DOWN"; |
| gpios = <&gpioc 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; |
| zephyr,code = <INPUT_KEY_DOWN>; |
| }; |
| joy_right: button3 { |
| label = "JOY_RIGHT"; |
| gpios = <&gpioc 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; |
| zephyr,code = <INPUT_KEY_RIGHT>; |
| }; |
| joy_up: button4 { |
| label = "JOY_UP"; |
| gpios = <&gpioc 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; |
| zephyr,code = <INPUT_KEY_UP>; |
| }; |
| }; |
| |
| cc_config { |
| compatible = "gpio-leds"; |
| encc1 { |
| gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>; |
| label = "ENCC1"; |
| }; |
| |
| encc2 { |
| gpios = <&gpiob 11 GPIO_ACTIVE_HIGH>; |
| label = "ENCC2"; |
| }; |
| |
| rdcc1 { |
| gpios = <&gpiob 12 GPIO_ACTIVE_LOW>; |
| label = "RDCC1"; |
| }; |
| }; |
| |
| 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; |
| watchdog0 = &iwdg; |
| }; |
| }; |
| |
| &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>; |
| }; |
| |
| &usart3 { |
| pinctrl-0 = <&usart3_tx_pc10 &usart3_rx_pc11>; |
| pinctrl-names = "default"; |
| current-speed = <115200>; |
| status = "okay"; |
| }; |
| |
| &i2c1 { |
| status = "okay"; |
| pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; |
| pinctrl-names = "default"; |
| status = "okay"; |
| clock-frequency = <I2C_BITRATE_FAST>; |
| |
| /* |
| * Use U10, INA230 to measure VBUS. I2C Address: 0x40 |
| */ |
| vbus_meas: ina230@40 { |
| status = "okay"; |
| compatible = "ti,ina230"; |
| reg = <0x40>; |
| adc-mode = "Bus voltage continuous"; |
| vbus-conversion-time-us = <1100>; |
| vshunt-conversion-time-us = <1100>; |
| avg-count = <1>; |
| current-lsb-microamps = <1000>; |
| rshunt-micro-ohms = <15000>; |
| }; |
| }; |
| |
| &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-0 = <&ucpd1_cc1_pa8 &ucpd1_cc2_pb15>; |
| pinctrl-names = "default"; |
| }; |
| |
| &iwdg { |
| status = "okay"; |
| }; |