Skip to content

Commit

Permalink
Add Aurora One Variant
Browse files Browse the repository at this point in the history
https://www.bfykorea.com/aurora-one/

Supersede stm32duino#1176

Signed-off-by: JongHyeon Lee <jhlee@bfykorea.com>
Co-authored-by: Frederic.Pillon <frederic.pillon@st.com>
  • Loading branch information
JongHyeon Lee and fpistm committed Jan 29, 2021
1 parent 89e0193 commit 9143eb7
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d

| Status | Device(s) | Name | Release | Notes |
| :----: | :-------: | ---- | :-----: | :---- |
| :yellow_heart: | STM32G030K8 | [Aurora One](https://www.bfykorea.com/aurora-one) | **2.0.0** |
| :yellow_heart: | STM32G031K6<br>STM32G030K8 | Generic Board | **2.0.0** | |
| :yellow_heart: | STM32G031J4<br>STM32G031J6 | Generic Board | **2.0.0** | |
| :yellow_heart: | STM32G071R6<br>STM32G071R8<br>STM32G071RB | Generic Board | **2.0.0** | |
Expand Down
8 changes: 8 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,14 @@ GenG0.menu.pnum.GENERIC_G030K8.build.board=GENERIC_G030K8
GenG0.menu.pnum.GENERIC_G030K8.build.product_line=STM32G030xx
GenG0.menu.pnum.GENERIC_G030K8.build.variant=STM32G0xx/Generic_G030Kx

# Aurora One G030K8
GenG0.menu.pnum.AURORA_ONE=Aurora One
GenG0.menu.pnum.AURORA_ONE.upload.maximum_size=65536
GenG0.menu.pnum.AURORA_ONE.upload.maximum_data_size=16384
GenG0.menu.pnum.AURORA_ONE.build.board=AURORA_ONE
GenG0.menu.pnum.AURORA_ONE.build.product_line=STM32G030xx
GenG0.menu.pnum.AURORA_ONE.build.variant=STM32G0xx/Generic_G030Kx

# Generic G031J4
GenG0.menu.pnum.GENERIC_G031J4=Generic G031J4
GenG0.menu.pnum.GENERIC_G031J4.upload.maximum_size=16384
Expand Down
3 changes: 2 additions & 1 deletion variants/STM32G0xx/Generic_G030Kx/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
*******************************************************************************
*/

#if defined(ARDUINO_GENERIC_G030K6) || defined(ARDUINO_GENERIC_G030K8)
#include "pins_arduino.h"

#ifdef __cplusplus
Expand Down Expand Up @@ -171,3 +171,4 @@ WEAK void SystemClock_Config(void)
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* ARDUINO_GENERIC_* */
6 changes: 5 additions & 1 deletion variants/STM32G0xx/Generic_G030Kx/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
*
*******************************************************************************
*/

#if !defined(ARDUINO_GENERIC_G030K6) && !defined(ARDUINO_GENERIC_G030K8)
#include "variant_AURORA_ONE.h"
#else
#ifndef _VARIANT_ARDUINO_STM32_
#define _VARIANT_ARDUINO_STM32_

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
Expand Down Expand Up @@ -159,3 +162,4 @@ extern "C" {
#endif

#endif /* _VARIANT_ARDUINO_STM32_ */
#endif /* ARDUINO_GENERIC_* */
127 changes: 127 additions & 0 deletions variants/STM32G0xx/Generic_G030Kx/variant_AURORA_ONE.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
*******************************************************************************
* Copyright (c) 2021, STMicroelectronics
* All rights reserved.
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
*******************************************************************************
*/
#if defined(ARDUINO_AURORA_ONE)
#include "pins_arduino.h"

#ifdef __cplusplus
extern "C" {
#endif

// Digital PinName array
const PinName digitalPin[] = {
PA_10, //D0
PA_9, //D1
PA_6, //D2/A6
PA_7, //D3/A7
PA_8, //D4
PC_6, //D5
PA_11, //D6/A10
PA_12, //D7/A11
PB_2, //D8/A12
PB_1, //D9/A9
PB_0, //D10/A8
PB_5, //D11
PB_4, //D12
PB_3, //D13/LED
PB_7, //D14/A13
PB_6, //D15
PB_9, //D16/MAINSL
PB_8, //D17/MAINSL
PA_15, //D18/MAINSL
PA_14, //D19/A14/SWCLK
PA_13, //D20/A15/SWDIO
PA_0, //D21/A0
PA_1, //D22/A1
PA_2, //D23/A2
PA_3, //D24/A3
PA_4, //D25/A4
PA_5, //D26/A5
PA_9_R, //D27
PA_10_R //D28
};

// Analog (Ax) pin number array
const uint32_t analogInputPin[] = {
21, //A0
22, //A1
23, //A2
24, //A3
25, //A4
26, //A5
2, //A6
3, //A7
10, //A8
9, //A9
6, //A10
7, //A11
8, //A12
14, //A13
19, //A14
20 //A15
};

#ifdef __cplusplus
}
#endif

// ----------------------------------------------------------------------------

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief System Clock Configuration
* @param None
* @retval None
*/
WEAK void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};

/* Configure the main internal regulator output voltage */
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
/*
* Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
RCC_OscInitStruct.PLL.PLLN = 8;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
/* Initializes the CPU, AHB and APB buses clocks */
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
| RCC_CLOCKTYPE_PCLK1;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
Error_Handler();
}
}

#ifdef __cplusplus
}
#endif
#endif /* ARDUINO_AURORA_ONE */
120 changes: 120 additions & 0 deletions variants/STM32G0xx/Generic_G030Kx/variant_AURORA_ONE.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
*******************************************************************************
* Copyright (c) 2021, STMicroelectronics
* All rights reserved.
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
*******************************************************************************
*/
#if defined(ARDUINO_AURORA_ONE)
#ifndef _VARIANT_ARDUINO_STM32_
#define _VARIANT_ARDUINO_STM32_

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

/*----------------------------------------------------------------------------
* STM32 pins number
*----------------------------------------------------------------------------*/
#define PA10 0
#define PA9 1
#define PA6 A6
#define PA7 A7
#define PA8 4
#define PC6 5
#define PA11 A10
#define PA12 A11
#define PB2 A12
#define PB1 A9
#define PB0 A8
#define PB5 11
#define PB4 12
#define PB3 13 // LED
#define PB7 A13
#define PB6 15
#define PB9 16
#define PB8 17
#define PA15 18
#define PA14 A14 // SWD / BOOT0
#define PA13 A15 // SWD
#define PA0 A0
#define PA1 A1
#define PA2 A2
#define PA3 A3
#define PA4 A4
#define PA5 A5
#define PA9_R 27
#define PA10_R 28
// #define PC14 29 // OSC32IN
// #define PC15 30 // OSC32OUT

// Alternate pins number
#define PA6_ALT1 (PA6 | ALT1)
#define PA7_ALT1 (PA7 | ALT1)
#define PA7_ALT2 (PA7 | ALT2)
#define PA7_ALT3 (PA7 | ALT3)
#define PB0_ALT1 (PB0 | ALT1)
#define PB1_ALT1 (PB1 | ALT1)
#define PB1_ALT2 (PB1 | ALT2)
#define PB6_ALT1 (PB6 | ALT1)

#define NUM_DIGITAL_PINS 29
#define NUM_REMAP_PINS 2
#define NUM_ANALOG_INPUTS 16

// On-board LED pin number
#define LED_BUILTIN PB3
#define LED_GREEN LED_BUILTIN

// Timer Definitions
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
#ifndef TIMER_TONE
#define TIMER_TONE TIM14
#endif
#ifndef TIMER_SERVO
#define TIMER_SERVO TIM16
#endif

// UART Definitions
#define SERIAL_UART_INSTANCE 2 //Connected to Aurora Connect Lite

// Default pin used for 'Serial' instance (ex: ST-Link)
// Mandatory for Firmata
#define PIN_SERIAL_RX PA10
#define PIN_SERIAL_TX PA9

#ifdef __cplusplus
} // extern "C"
#endif

/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/

#ifdef __cplusplus
// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
//
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
//
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
//
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
//
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#define SERIAL_PORT_MONITOR Serial
#define SERIAL_PORT_HARDWARE Serial2
#endif

#endif /* _VARIANT_ARDUINO_STM32_ */
#endif /* ARDUINO_AURORA_ONE */

0 comments on commit 9143eb7

Please sign in to comment.