Skip to content

Commit f6ea9fb

Browse files
committed
Added new Agafia SG0 Board
AGAFIA SG0 board is based on STM32G071CB
1 parent a04d6e1 commit f6ea9fb

File tree

4 files changed

+343
-1
lines changed

4 files changed

+343
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
296296
| :green_heart: | STM32G030C6<br>STM32G030C8 | Generic Board | *2.2.0* |
297297
| :green_heart: | STM32G030F6<br>STM32G030F6 | Generic Board | *2.2.0* |
298298
| :green_heart: | STM32G030K8 | [Aurora One](https://www.bfy.kr/aurora-one/) | *2.0.0* |
299+
| :yellow_heart: | STM32G071CB | [AGAFIA SG0](https://www.sigmaic.com/agafia-sgo/) | *2.0.0* |
299300
| :green_heart: | STM32G030K6<br>STM32G030K8 | Generic Board | *2.0.0* | |
300301
| :green_heart: | STM32G031J4<br>STM32G031J6 | Generic Board | *2.0.0* | |
301302
| :yellow_heart: | STM32G031F4<br>STM32G031F6<br>STM32G031F8 | Generic Board | **2.3.0** | |

boards.txt

+10-1
Original file line numberDiff line numberDiff line change
@@ -3189,7 +3189,7 @@ GenG0.menu.pnum.AURORA_ONE.build.board=AURORA_ONE
31893189
GenG0.menu.pnum.AURORA_ONE.build.product_line=STM32G030xx
31903190
GenG0.menu.pnum.AURORA_ONE.build.variant=STM32G0xx/G030K(6-8)T
31913191
GenG0.menu.pnum.AURORA_ONE.build.variant_h=variant_{build.board}.h
3192-
3192+
31933193
# Generic G030C6Tx
31943194
GenG0.menu.pnum.GENERIC_G030C6TX=Generic G030C6Tx
31953195
GenG0.menu.pnum.GENERIC_G030C6TX.upload.maximum_size=32768
@@ -3414,6 +3414,15 @@ GenG0.menu.pnum.GENERIC_G070RBTX.build.board=GENERIC_G070RBTX
34143414
GenG0.menu.pnum.GENERIC_G070RBTX.build.product_line=STM32G070xx
34153415
GenG0.menu.pnum.GENERIC_G070RBTX.build.variant=STM32G0xx/G070RBT
34163416

3417+
# AGAFIA SG0
3418+
GenG0.menu.pnum.AGAFIA_SG0=AGAFIA SG0
3419+
GenG0.menu.pnum.AGAFIA_SG0.upload.maximum_size=131072
3420+
GenG0.menu.pnum.AGAFIA_SG0.upload.maximum_data_size=36864
3421+
GenG0.menu.pnum.AGAFIA_SG0.build.board=AGAFIA_SG0
3422+
GenG0.menu.pnum.AGAFIA_SG0.build.product_line=STM32G071xx
3423+
GenG0.menu.pnum.AGAFIA_SG0.build.variant=STM32G0xx/G071C(6-8-B)(T-U)_G081CB(T-U)
3424+
GenG0.menu.pnum.AGAFIA_SG0.build.variant_h=variant_{build.board}.h
3425+
34173426
# Generic G071R6Tx
34183427
GenG0.menu.pnum.GENERIC_G071R6TX=Generic G071R6Tx
34193428
GenG0.menu.pnum.GENERIC_G071R6TX.upload.maximum_size=32768
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2019, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
31+
#if defined(ARDUINO_AGAFIA_SG0)
32+
#include "pins_arduino.h"
33+
34+
#ifdef __cplusplus
35+
extern "C" {
36+
#endif
37+
38+
// Pin number
39+
const PinName digitalPin[] = {
40+
PA_10, //D0
41+
PA_9 , //D1
42+
PA_12, //D2
43+
PC_6, //D3 //SPI_CLK
44+
PB_15, //D4
45+
PB_14, //D5
46+
PA_8, //D6
47+
PB_13, //D7
48+
PC_7, //D8
49+
PB_3, //D9
50+
PB_0, //D10 //SPI_CS
51+
PA_7, //D11 //SPI_MOSI
52+
PA_6, //D12 //SPI_MISO
53+
PA_5, //D13 //SPI_CLK
54+
PB_9, //D14
55+
PB_8, //D15
56+
57+
58+
PA_3, //D16
59+
PA_2, //D17
60+
PA_0, //D18
61+
PA_1, //D19
62+
63+
PA_11, //D20
64+
PA_15, //D21
65+
PD_0, //D22
66+
PD_1, //D23
67+
PD_2, //D24
68+
PD_3, //D25
69+
PD_4, //D26
70+
PB_4, //D27
71+
PB_5, //D28
72+
PB_6, //D29
73+
PB_7, //D30
74+
75+
PA_14, //D31
76+
PA_13, //D32
77+
78+
PF_0, //D33
79+
PF_1, //D34
80+
PC_13, //D35
81+
82+
PA_4, //D36 //A0 //DAC1
83+
PB_12, //D37 //A1
84+
PB_11, //D38 //A2
85+
PB_10, //D39 //A3
86+
PB_2, //D40 //A4
87+
PB_1 //D41 //A5
88+
};
89+
90+
// Analog (Ax) pin number array
91+
const uint32_t analogInputPin[] = {
92+
36, //A0
93+
37, //A1
94+
38, //A2
95+
39, //A3
96+
40, //A4
97+
41, //A5
98+
};
99+
100+
101+
#ifdef __cplusplus
102+
}
103+
#endif
104+
105+
// ----------------------------------------------------------------------------
106+
107+
#ifdef __cplusplus
108+
extern "C" {
109+
#endif
110+
111+
/**
112+
* @brief System Clock Configuration
113+
* The system Clock is configured as follows :
114+
* System Clock source = PLL (HSI)
115+
* SYSCLK(Hz) = 64000000
116+
* HCLK(Hz) = 64000000
117+
* AHB Prescaler = 1
118+
* APB1 Prescaler = 1
119+
* MSI Frequency(Hz) = 16000000
120+
* PLL_M = 1
121+
* PLL_N = 8
122+
* PLL_R = 2
123+
* PLL_P = 2
124+
* PLL_Q = 2
125+
* Flash Latency(WS) = 2
126+
* @param None
127+
* @retval None
128+
*/
129+
WEAK void SystemClock_Config(void)
130+
{
131+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
132+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
133+
134+
/* Configure the main internal regulator output voltage */
135+
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
136+
/* Initializes the CPU, AHB and APB busses clocks */
137+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
138+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
139+
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
140+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
141+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
142+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
143+
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
144+
RCC_OscInitStruct.PLL.PLLN = 8;
145+
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
146+
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
147+
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
148+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
149+
Error_Handler();
150+
}
151+
/* Initializes the CPU, AHB and APB busses clocks */
152+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
153+
| RCC_CLOCKTYPE_PCLK1;
154+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
155+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
156+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
157+
158+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
159+
Error_Handler();
160+
}
161+
}
162+
#ifdef __cplusplus
163+
}
164+
#endif
165+
#endif /* ARDUINO_AGAFIA_SG0 */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2019, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
31+
#pragma once
32+
33+
/*----------------------------------------------------------------------------
34+
* Pins
35+
*----------------------------------------------------------------------------*/
36+
37+
#define PA10 0 // UART1_RX
38+
#define PA9 1 // UART1_TX
39+
#define PA12 2
40+
#define PC6 3
41+
#define PB15 4
42+
#define PB14 5
43+
#define PA8 6
44+
#define PB13 7
45+
#define PC7 8
46+
#define PB3 9
47+
#define PB0 10 // SPI_CS
48+
#define PA7 11 // SPI_MOSI
49+
#define PA6 12 // SPI_MISO
50+
#define PA5 13 // SPI_CLK
51+
#define PB9 14 // SDA
52+
#define PB8 15 // SCL
53+
54+
//SERIAL PINS
55+
#define PA3 16
56+
#define PA2 17
57+
#define PA0 18
58+
#define PA1 19
59+
60+
//TOP PIN CONN
61+
#define PA11 20
62+
#define PA15 21
63+
#define PD0 22
64+
#define PD1 23
65+
#define PD2 24
66+
#define PD3 25
67+
#define PD4 26
68+
#define PB4 27
69+
#define PB5 28
70+
#define PB6 29
71+
#define PB7 30
72+
73+
#define PA14 31 //SCK-BOOT0
74+
#define PA13 32 //SWDIO
75+
76+
#define PF0 33 //LED3
77+
#define PF1 34 //LED2
78+
#define PC13 35 //LED1
79+
80+
#define PA4 36 // A0
81+
#define PB12 37 // A1
82+
#define PB11 38 // A2
83+
#define PB10 39 // A3
84+
#define PB2 40 // A4
85+
#define PB1 41 // A5
86+
87+
// This must be a literal
88+
#define NUM_DIGITAL_PINS 42
89+
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
90+
#define NUM_ANALOG_INPUTS 10
91+
92+
93+
// On-board LED pin number
94+
#ifndef LED_BUILTIN
95+
#define LED_BUILTIN PC13
96+
#endif
97+
#define LED1 LED_BUILTIN
98+
#define LED2 PF0
99+
#define LED3 PF1
100+
101+
102+
// SPI Definitions
103+
#define PIN_SPI_SS PB0
104+
#define PIN_SPI_MOSI PA7
105+
#define PIN_SPI_MISO PA6
106+
#define PIN_SPI_SCK PA5
107+
108+
// I2C Definitions
109+
#define PIN_WIRE_SDA PB9
110+
#define PIN_WIRE_SCL PB8
111+
112+
// Timer Definitions
113+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
114+
#ifndef TIMER_TONE
115+
#define TIMER_TONE TIM6
116+
#endif
117+
#ifndef TIMER_SERVO
118+
#define TIMER_SERVO TIM7
119+
#endif
120+
121+
#define PIN_DAC1 PA4
122+
#define PIN_DAC2 PA5
123+
124+
// UART Definitions
125+
#ifndef SERIAL_UART_INSTANCE
126+
#define SERIAL_UART_INSTANCE 101 //Connected to ST-Link
127+
#endif
128+
129+
// Default pin used for 'Serial' instance (ex: ST-Link)
130+
// Mandatory for Firmata
131+
#ifndef PIN_SERIAL_RX
132+
#define PIN_SERIAL_RX PA3
133+
#endif
134+
#ifndef PIN_SERIAL_TX
135+
#define PIN_SERIAL_TX PA2
136+
#endif
137+
138+
// Extra HAL modules
139+
#if !defined(HAL_DAC_MODULE_DISABLED)
140+
#define HAL_DAC_MODULE_ENABLED
141+
#endif
142+
143+
144+
/*----------------------------------------------------------------------------
145+
* Arduino objects - C++ only
146+
*----------------------------------------------------------------------------*/
147+
148+
#ifdef __cplusplus
149+
// These serial port names are intended to allow libraries and architecture-neutral
150+
// sketches to automatically default to the correct port name for a particular type
151+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
152+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
153+
//
154+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
155+
//
156+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
157+
//
158+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
159+
//
160+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
161+
//
162+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
163+
// pins are NOT connected to anything by default.
164+
#define SERIAL_PORT_MONITOR Serial
165+
#define SERIAL_PORT_HARDWARE Serial2
166+
#endif
167+

0 commit comments

Comments
 (0)