Add Nucleo G474RE board for testing purposes

This commit is contained in:
Martin Jäger
2021-02-05 17:51:10 +01:00
parent c151213325
commit fc71934010
9 changed files with 365 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
# STM32G474RE Nucleo board configuration
# Copyright (c) 2019 STMicroelectronics.
# SPDX-License-Identifier: Apache-2.0
config BOARD_NUCLEO_G474RE
bool "Nucleo G474RE Development Board"
depends on SOC_STM32G474XX
@@ -0,0 +1,14 @@
# STM32G474RE Nucleo board configuration
# Copyright (c) 2019 STMicroelectronics.
# SPDX-License-Identifier: Apache-2.0
if BOARD_NUCLEO_G474RE
config BOARD
default "nucleo_g474re"
config LIBRE_SOLAR_TYPE_ID
default 0
endif # BOARD_NUCLEO_G431RB
+10
View File
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: Apache-2.0
# use target=stm32g474rbtx instead of stm32g474retx
# to allow board re-flashing (see PR #23230)
board_runner_args(pyocd "--target=stm32g474rbtx")
board_runner_args(jlink "--device=STM32G474RE" "--speed=4000" "--reset-after-load")
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
+190
View File
@@ -0,0 +1,190 @@
/*
* Copyright (c) 2019 STMicroelectronics.
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* This is a dummy charge controller board for testing new features using the STM32G474 MCU
*
* IMPORTANT: You have to remove the VREF jumper on the Nucleo board to make it work. Otherwise
* the MCU will get stuck while trying to generate a reference voltage at VREF+ pin.
*/
/dts-v1/;
#include <st/g4/stm32g474Xe.dtsi>
#include <st/g4/stm32g474r(b-c-e)tx-pinctrl.dtsi>
/ {
model = "STMicroelectronics STM32G474RE-NUCLEO board";
compatible = "st,stm32g474re-nucleo";
pcb {
compatible = "charge-controller";
type = "Nucleo G474 dummy charge controller";
version-str = "v0.1";
version-num = <1>;
hs-voltage-max = <80>;
ls-voltage-max = <32>;
dcdc-current-max = <20>;
};
chosen {
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
};
leds {
compatible = "charlieplexing-leds";
gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
pwr {
states = <1>;
};
};
outputs {
compatible = "outputs";
can_en {
label = "CAN disable / standby";
gpios = <&gpiob 11 GPIO_ACTIVE_LOW>;
};
};
adc-inputs {
compatible = "adc-inputs";
v-low {
io-channels = <&adc1 12>;
multiplier = <105600>;
divider = <5600>;
};
v-high {
io-channels = <&adc1 15>;
multiplier = <102200>;
divider = <2200>;
};
vref-mcu {
io-channels = <&adc1 18>;
multiplier = <1>;
divider = <1>;
};
temp-mcu {
io-channels = <&adc1 16>;
multiplier = <1>;
divider = <1>;
};
i-dcdc {
io-channels = <&adc2 1>;
// amp gain: 25, resistor: 2 mOhm
multiplier = <1000>; // 1000
divider = <50>; // 2*25
};
};
gpio_keys {
compatible = "gpio-keys";
user_button: button {
label = "User";
gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
};
};
aliases {
sw0 = &user_button;
uart-dbg = &lpuart1;
uart-uext = &usart1;
spi-uext = &spi1;
i2c-uext = &i2c1;
};
};
&usart1 {
pinctrl-0 = <&usart1_tx_pc4 &usart1_rx_pc5>;
current-speed = <115200>;
status = "okay";
};
&lpuart1 {
pinctrl-0 = <&lpuart1_tx_pa2 &lpuart1_rx_pa3>;
current-speed = <115200>;
status = "okay";
};
&i2c1 {
pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
status = "okay";
};
&spi1 {
pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pb3
&spi1_miso_pa6 &spi1_mosi_pa7>;
status = "okay";
};
&timers1 {
status = "okay";
halfbridge {
compatible = "half-bridge";
pinctrl-0 = <&tim1_ch1_pa8 &tim1_ch1n_pb13>;
frequency = <70000>;
deadtime = <300>;
};
};
&rtc {
status = "okay";
};
&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Set 2Kb of storage at the end of the 128Kb of flash */
storage_partition: partition@1f800 {
label = "storage";
reg = <0x0001f800 0x00000800>;
};
};
};
&iwdg {
status = "okay";
};
&rng {
status = "okay";
};
&adc1 {
pinctrl-0 = <&adc1_in1_pa0>;
status = "okay";
};
&can1 {
pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
bus-speed = <250000>;
bus-speed-data = <250000>;
sjw = <1>;
sjw-data = <1>;
sample-point = <875>;
sample-point-data = <875>;
status = "okay";
};
@@ -0,0 +1,22 @@
identifier: nucleo_g474re
name: ST Nucleo G474RE
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 128
flash: 512
supported:
- nvs
- pwm
- i2c
- gpio
- usb device
- counter
- spi
- watchdog
- adc
- can
- canfd
@@ -0,0 +1,68 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_STM32G4X=y
CONFIG_SOC_STM32G474XX=y
# 170MHz system clock only in 'boost power' mode.
# RM0440, section 5.1.5 states that the R1MODE bit
# must be cleared before system can be 170MHz.
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=170000000
# 150MHz system clock in 'normal power' mode
# CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=150000000
# enable uart driver
CONFIG_SERIAL=y
# enable pinmux
CONFIG_PINMUX=y
# enable GPIO
CONFIG_GPIO=y
# clock configuration
CONFIG_CLOCK_CONTROL=y
# Use PLLCLK for SYSCLK
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# Use HSE (24MHz) to feed into PLL
CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
CONFIG_CLOCK_STM32_HSE_CLOCK=24000000
CONFIG_CLOCK_STM32_PLL_P_DIVISOR=7
CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=2
CONFIG_CLOCK_STM32_PLL_R_DIVISOR=2
# Produce 150MHz clock at PLLCLK output
# CONFIG_CLOCK_STM32_PLL_M_DIVISOR=4
# CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=75
# Produce 170MHz clock at PLLCLK output
CONFIG_CLOCK_STM32_PLL_M_DIVISOR=6
CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=85
# Produce Max (150MHz or 170MHz) HCLK
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
# Produce Max (150MHz or 170MHz) APB1 clocks and APB2 clocks
CONFIG_CLOCK_STM32_APB1_PRESCALER=1
CONFIG_CLOCK_STM32_APB2_PRESCALER=1
# Console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Enable MPU
CONFIG_ARM_MPU=y
# Enable HW stack protection
CONFIG_HW_STACK_PROTECTION=y
CONFIG_CAN=y
CONFIG_THINGSET_CAN=y
CONFIG_ISOTP=y
CONFIG_ISOTP_RX_BUF_COUNT=2
CONFIG_ISOTP_RX_BUF_SIZE=100
CONFIG_ISOTP_RX_SF_FF_BUF_COUNT=2
@@ -0,0 +1,7 @@
source [find interface/stlink.cfg]
transport select hla_swd
source [find target/stm32g4x.cfg]
reset_config srst_only
+42
View File
@@ -0,0 +1,42 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32G4xx -DSTM32G474xx",
"f_cpu": "170000000L",
"mcu": "stm32g474ret6",
"product_line": "STM32G474xx",
"variant": "NUCLEO_G474RE"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "STM32G474RE",
"openocd_target": "stm32g4x",
"svd_path": "STM32G474xx.svd"
},
"frameworks": [
"arduino",
"cmsis",
"mbed",
"libopencm3",
"stm32cube",
"zephyr"
],
"name": "Nucleo G474RE",
"upload": {
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "mbed",
"protocols": [
"jlink",
"stlink",
"cmsis-dap",
"blackmagic",
"mbed"
]
},
"url": "https://www.st.com/en/evaluation-tools/nucleo-g474re.html",
"vendor": "ST"
}
+4
View File
@@ -86,6 +86,10 @@ board = mppt_2420_hpx
[env:pwm_2420_lus]
board = pwm_2420_lus@0.3
# Nucleo board for testing purposes
[env:nucleo_g474re]
board = nucleo_g474re
[env:unit_test]
platform = native
framework =