Skip to content

Commit f34894a

Browse files
ALTracerfpistm
authored andcommitted
variant(g4): add WeAct G474CEU support
1 parent c82f861 commit f34894a

File tree

4 files changed

+373
-0
lines changed

4 files changed

+373
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
492492

493493
| Status | Device(s) | Name | Release | Notes |
494494
| :----: | :-------: | ---- | :-----: | :---- |
495+
| :yellow_heart: | STM32G474CEU | WeAct G474CE | **2.10.0** | [More info](https://github.com/WeActStudio/WeActStudio.STM32G474CoreBoard) |
495496
| :green_heart: | STM32G431C6<br>STM32G431C8<br>STM32G431CB | Generic Board | *2.4.0* | |
496497
| :green_heart: | STM32G431C6U<br>STM32G431C8U<br>STM32G431CBU | Generic Board | *2.0.0* | |
497498
| :green_heart: | STM32G431M6<br>STM32G431M8<br>STM32G431MB | Generic Board | *2.4.0* | |

boards.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7453,6 +7453,16 @@ GenG4.openocd.target=stm32g4x
74537453
GenG4.vid.0=0x0483
74547454
GenG4.pid.0=0x5740
74557455

7456+
# WEACT_G474CE board
7457+
GenG4.menu.pnum.WEACT_G474CE=WeAct G474CE
7458+
GenG4.menu.pnum.WEACT_G474CE.upload.maximum_size=524288
7459+
GenG4.menu.pnum.WEACT_G474CE.upload.maximum_data_size=131072
7460+
GenG4.menu.pnum.WEACT_G474CE.build.board=WEACT_G474CE
7461+
GenG4.menu.pnum.WEACT_G474CE.build.product_line=STM32G474xx
7462+
GenG4.menu.pnum.WEACT_G474CE.build.variant=STM32G4xx/G473C(B-C-E)U_G474C(B-C-E)U_G483CEU_G484CEU
7463+
GenG4.menu.pnum.WEACT_G474CE.build.variant_h=variant_{build.board}.h
7464+
GenG4.menu.pnum.WEACT_G474CE.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32G4xx/STM32G474.svd
7465+
74567466
# Generic G431C6Tx
74577467
GenG4.menu.pnum.GENERIC_G431C6TX=Generic G431C6Tx
74587468
GenG4.menu.pnum.GENERIC_G431C6TX.upload.maximum_size=32768
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2024, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by ST under BSD 3-Clause license,
7+
* the "License"; You may not use this file except in compliance with the
8+
* License. You may obtain a copy of the License at:
9+
* opensource.org/licenses/BSD-3-Clause
10+
*
11+
*******************************************************************************
12+
*/
13+
#if defined(ARDUINO_WEACT_G474CE)
14+
#include "pins_arduino.h"
15+
16+
// Digital PinName array
17+
const PinName digitalPin[] = {
18+
PA_0, // D0/A0
19+
PA_1, // D1/A1
20+
PA_2, // D2/A2
21+
PA_3, // D3/A3
22+
PA_4, // D4/A4
23+
PA_5, // D5/A5
24+
PA_6, // D6/A6
25+
PA_7, // D7/A7
26+
PA_8, // D8/A8
27+
PA_9, // D9/A9
28+
PA_10, // D10
29+
PA_11, // D11
30+
PA_12, // D12
31+
PA_13, // D13/SWDIO
32+
PA_14, // D14/SWCLK
33+
PA_15, // D15
34+
PB_0, // D16/A10
35+
PB_1, // D17/A11
36+
PB_2, // D18/A12
37+
PB_3, // D19
38+
PB_4, // D20
39+
PB_5, // D21
40+
PB_6, // D22
41+
PB_7, // D23
42+
PB_8, // D24
43+
PB_9, // D25
44+
PB_10, // D26
45+
PB_11, // D27/A13
46+
PB_12, // D28/A14
47+
PB_13, // D29/A15
48+
PB_14, // D30/A16
49+
PB_15, // D31/A17
50+
PC_4, // D32/A18
51+
PC_6, // D33/LED
52+
PC_10, // D34
53+
PC_11, // D35
54+
PC_13, // D36/BTN
55+
PC_14, // D37
56+
PC_15, // D38
57+
PF_0, // D39/A19
58+
PF_1, // D40/A20
59+
PG_10 // D41
60+
};
61+
62+
// Analog (Ax) pin number array
63+
const uint32_t analogInputPin[] = {
64+
0, // A0, PA0
65+
1, // A1, PA1
66+
2, // A2, PA2
67+
3, // A3, PA3
68+
4, // A4, PA4
69+
5, // A5, PA5
70+
6, // A6, PA6
71+
7, // A7, PA7
72+
8, // A8, PA8
73+
9, // A9, PA9
74+
16, // A10, PB0
75+
17, // A11, PB1
76+
18, // A12, PB2
77+
27, // A13, PB11
78+
28, // A14, PB12
79+
29, // A15, PB13
80+
30, // A16, PB14
81+
31, // A17, PB15
82+
32, // A18, PC4
83+
39, // A19, PF0
84+
40 // A20, PF1
85+
};
86+
87+
// ----------------------------------------------------------------------------
88+
89+
#ifdef __cplusplus
90+
extern "C" {
91+
#endif // __cplusplus
92+
93+
/**
94+
* @brief System Clock Configuration
95+
*/
96+
WEAK void SystemClock_Config(void)
97+
{
98+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
99+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
100+
#ifdef USBCON
101+
RCC_PeriphCLKInitTypeDef PeriphClkInit = {};
102+
#endif
103+
104+
/* Configure the main internal regulator output voltage */
105+
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST);
106+
/* Initializes the CPU, AHB and APB busses clocks */
107+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSI48
108+
| RCC_OSCILLATORTYPE_HSE;
109+
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
110+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
111+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
112+
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
113+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
114+
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV4;
115+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
116+
RCC_OscInitStruct.PLL.PLLN = 85;
117+
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
118+
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV6;
119+
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
120+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
121+
Error_Handler();
122+
}
123+
/* Initializes the CPU, AHB and APB busses clocks */
124+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
125+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
126+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
127+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
128+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
129+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
130+
131+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) {
132+
Error_Handler();
133+
}
134+
135+
#ifdef USBCON
136+
/* Initializes the peripherals clocks */
137+
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
138+
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
139+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
140+
Error_Handler();
141+
}
142+
#endif
143+
}
144+
145+
#ifdef __cplusplus
146+
} // extern "C"
147+
#endif
148+
149+
#endif /* ARDUINO_NUCLEO_G431RB */
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2024, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by ST under BSD 3-Clause license,
7+
* the "License"; You may not use this file except in compliance with the
8+
* License. You may obtain a copy of the License at:
9+
* opensource.org/licenses/BSD-3-Clause
10+
*
11+
*******************************************************************************
12+
*/
13+
#pragma once
14+
15+
/*----------------------------------------------------------------------------
16+
* STM32 pins number
17+
*----------------------------------------------------------------------------*/
18+
#define PA0 PIN_A0
19+
#define PA1 PIN_A1
20+
#define PA2 PIN_A2
21+
#define PA3 PIN_A3
22+
#define PA4 PIN_A4
23+
#define PA5 PIN_A5
24+
#define PA6 PIN_A6
25+
#define PA7 PIN_A7
26+
#define PA8 PIN_A8
27+
#define PA9 PIN_A9
28+
#define PA10 10
29+
#define PA11 11
30+
#define PA12 12
31+
#define PA13 13
32+
#define PA14 14
33+
#define PA15 15
34+
#define PB0 PIN_A10
35+
#define PB1 PIN_A11
36+
#define PB2 PIN_A12
37+
#define PB3 19
38+
#define PB4 20
39+
#define PB5 21
40+
#define PB6 22
41+
#define PB7 23
42+
#define PB8 24
43+
#define PB9 25
44+
#define PB10 26
45+
#define PB11 PIN_A13
46+
#define PB12 PIN_A14
47+
#define PB13 PIN_A15
48+
#define PB14 PIN_A16
49+
#define PB15 PIN_A17
50+
#define PC4 PIN_A18
51+
#define PC6 33 // LED
52+
#define PC10 34
53+
#define PC11 35
54+
#define PC13 36 // BTN
55+
#define PC14 37
56+
#define PC15 38
57+
#define PF0 PIN_A19
58+
#define PF1 PIN_A20
59+
#define PG10 41
60+
61+
// Alternate pins number
62+
#define PA0_ALT1 (PA0 | ALT1)
63+
#define PA1_ALT1 (PA1 | ALT1)
64+
#define PA1_ALT2 (PA1 | ALT2)
65+
#define PA2_ALT1 (PA2 | ALT1)
66+
#define PA2_ALT2 (PA2 | ALT2)
67+
#define PA3_ALT1 (PA3 | ALT1)
68+
#define PA3_ALT2 (PA3 | ALT2)
69+
#define PA4_ALT1 (PA4 | ALT1)
70+
#define PA6_ALT1 (PA6 | ALT1)
71+
#define PA7_ALT1 (PA7 | ALT1)
72+
#define PA7_ALT2 (PA7 | ALT2)
73+
#define PA7_ALT3 (PA7 | ALT3)
74+
#define PA9_ALT1 (PA9 | ALT1)
75+
#define PA10_ALT1 (PA10 | ALT1)
76+
#define PA11_ALT1 (PA11 | ALT1)
77+
#define PA11_ALT2 (PA11 | ALT2)
78+
#define PA12_ALT1 (PA12 | ALT1)
79+
#define PA12_ALT2 (PA12 | ALT2)
80+
#define PA13_ALT1 (PA13 | ALT1)
81+
#define PA15_ALT1 (PA15 | ALT1)
82+
#define PB0_ALT1 (PB0 | ALT1)
83+
#define PB0_ALT2 (PB0 | ALT2)
84+
#define PB1_ALT1 (PB1 | ALT1)
85+
#define PB1_ALT2 (PB1 | ALT2)
86+
#define PB2_ALT1 (PB2 | ALT1)
87+
#define PB3_ALT1 (PB3 | ALT1)
88+
#define PB4_ALT1 (PB4 | ALT1)
89+
#define PB4_ALT2 (PB4 | ALT2)
90+
#define PB5_ALT1 (PB5 | ALT1)
91+
#define PB5_ALT2 (PB5 | ALT2)
92+
#define PB6_ALT1 (PB6 | ALT1)
93+
#define PB6_ALT2 (PB6 | ALT2)
94+
#define PB7_ALT1 (PB7 | ALT1)
95+
#define PB7_ALT2 (PB7 | ALT2)
96+
#define PB8_ALT1 (PB8 | ALT1)
97+
#define PB8_ALT2 (PB8 | ALT2)
98+
#define PB9_ALT1 (PB9 | ALT1)
99+
#define PB9_ALT2 (PB9 | ALT2)
100+
#define PB9_ALT3 (PB9 | ALT3)
101+
#define PB11_ALT1 (PB11 | ALT1)
102+
#define PB12_ALT1 (PB12 | ALT1)
103+
#define PB13_ALT1 (PB13 | ALT1)
104+
#define PB14_ALT1 (PB14 | ALT1)
105+
#define PB15_ALT1 (PB15 | ALT1)
106+
#define PB15_ALT2 (PB15 | ALT2)
107+
#define PC6_ALT1 (PC6 | ALT1)
108+
#define PC10_ALT1 (PC10 | ALT1)
109+
#define PC11_ALT1 (PC11 | ALT1)
110+
#define PC13_ALT1 (PC13 | ALT1)
111+
112+
#define NUM_DIGITAL_PINS 42
113+
#define NUM_ANALOG_INPUTS 21
114+
115+
// On-board LED pin number
116+
#ifndef LED_BUILTIN
117+
#define LED_BUILTIN PC6
118+
#endif
119+
120+
// On-board user button
121+
#ifndef USER_BTN
122+
#define USER_BTN PC13
123+
#endif
124+
125+
// SPI definitions
126+
#ifndef PIN_SPI_SS
127+
#define PIN_SPI_SS PA4
128+
#endif
129+
#ifndef PIN_SPI_SS1
130+
#define PIN_SPI_SS1 PA15
131+
#endif
132+
#ifndef PIN_SPI_SS2
133+
#define PIN_SPI_SS2 PNUM_NOT_DEFINED
134+
#endif
135+
#ifndef PIN_SPI_SS3
136+
#define PIN_SPI_SS3 PNUM_NOT_DEFINED
137+
#endif
138+
#ifndef PIN_SPI_MOSI
139+
#define PIN_SPI_MOSI PA7
140+
#endif
141+
#ifndef PIN_SPI_MISO
142+
#define PIN_SPI_MISO PA6
143+
#endif
144+
#ifndef PIN_SPI_SCK
145+
#define PIN_SPI_SCK PA5
146+
#endif
147+
148+
// I2C definitions
149+
#ifndef PIN_WIRE_SDA
150+
#define PIN_WIRE_SDA PA8
151+
#endif
152+
#ifndef PIN_WIRE_SCL
153+
#define PIN_WIRE_SCL PA9
154+
#endif
155+
156+
// Timer Definitions
157+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
158+
#ifndef TIMER_TONE
159+
#define TIMER_TONE TIM6
160+
#endif
161+
#ifndef TIMER_SERVO
162+
#define TIMER_SERVO TIM7
163+
#endif
164+
165+
// UART Definitions
166+
#ifndef SERIAL_UART_INSTANCE
167+
#define SERIAL_UART_INSTANCE 2
168+
#endif
169+
170+
// Default pin used for generic 'Serial' instance
171+
// Mandatory for Firmata
172+
#ifndef PIN_SERIAL_RX
173+
#define PIN_SERIAL_RX PA3
174+
#endif
175+
#ifndef PIN_SERIAL_TX
176+
#define PIN_SERIAL_TX PA2
177+
#endif
178+
179+
// Extra HAL modules
180+
#if !defined(HAL_DAC_MODULE_DISABLED)
181+
#define HAL_DAC_MODULE_ENABLED
182+
#endif
183+
#if !defined(HAL_QSPI_MODULE_DISABLED)
184+
#define HAL_QSPI_MODULE_ENABLED
185+
#endif
186+
187+
/*----------------------------------------------------------------------------
188+
* Arduino objects - C++ only
189+
*----------------------------------------------------------------------------*/
190+
191+
#ifdef __cplusplus
192+
// These serial port names are intended to allow libraries and architecture-neutral
193+
// sketches to automatically default to the correct port name for a particular type
194+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
195+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
196+
//
197+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
198+
//
199+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
200+
//
201+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
202+
//
203+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
204+
//
205+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
206+
// pins are NOT connected to anything by default.
207+
#ifndef SERIAL_PORT_MONITOR
208+
#define SERIAL_PORT_MONITOR Serial2
209+
#endif
210+
#ifndef SERIAL_PORT_HARDWARE
211+
#define SERIAL_PORT_HARDWARE Serial2
212+
#endif
213+
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy