diff --git a/README.md b/README.md index 554ea4a511..53e6c82fc2 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,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
STM32G030K8 | Generic Board | **2.0.0** | | | :yellow_heart: | STM32G031J4
STM32G031J6 | Generic Board | **2.0.0** | | | :yellow_heart: | STM32G071R6
STM32G071R8
STM32G071RB | Generic Board | **2.0.0** | | diff --git a/boards.txt b/boards.txt index 336fe9bfa8..fd1c3d7e7b 100644 --- a/boards.txt +++ b/boards.txt @@ -1661,6 +1661,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 diff --git a/variants/STM32G0xx/Generic_G030Kx/variant.cpp b/variants/STM32G0xx/Generic_G030Kx/variant.cpp index e3509f8c56..fab43edee9 100644 --- a/variants/STM32G0xx/Generic_G030Kx/variant.cpp +++ b/variants/STM32G0xx/Generic_G030Kx/variant.cpp @@ -10,7 +10,7 @@ * ******************************************************************************* */ - +#if defined(ARDUINO_GENERIC_G030K6) || defined(ARDUINO_GENERIC_G030K8) #include "pins_arduino.h" #ifdef __cplusplus @@ -179,3 +179,4 @@ WEAK void SystemClock_Config(void) #ifdef __cplusplus } // extern "C" #endif +#endif /* ARDUINO_GENERIC_* */ diff --git a/variants/STM32G0xx/Generic_G030Kx/variant.h b/variants/STM32G0xx/Generic_G030Kx/variant.h index 115fae8ff1..cfa27a218a 100644 --- a/variants/STM32G0xx/Generic_G030Kx/variant.h +++ b/variants/STM32G0xx/Generic_G030Kx/variant.h @@ -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 @@ -158,3 +161,4 @@ extern "C" { #endif #endif /* _VARIANT_ARDUINO_STM32_ */ +#endif /* ARDUINO_GENERIC_* */ diff --git a/variants/STM32G0xx/Generic_G030Kx/variant_AURORA_ONE.cpp b/variants/STM32G0xx/Generic_G030Kx/variant_AURORA_ONE.cpp new file mode 100644 index 0000000000..816b81a265 --- /dev/null +++ b/variants/STM32G0xx/Generic_G030Kx/variant_AURORA_ONE.cpp @@ -0,0 +1,135 @@ +/* + ******************************************************************************* + * Copyright (c) 2020, 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_ALTR, //D27 + PA_10_ALTR, //D28 + PA_6_ALT0, //D29 + PA_7_ALT0, //D30 + PA_7_ALT1, //D31 + PA_7_ALT2, //D32 + PB_0_ALT0, //D33 + PB_1_ALT0, //D34 + PB_1_ALT1, //D35 + PB_6_ALT0 //D36 +}; + +// 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 */ diff --git a/variants/STM32G0xx/Generic_G030Kx/variant_AURORA_ONE.h b/variants/STM32G0xx/Generic_G030Kx/variant_AURORA_ONE.h new file mode 100644 index 0000000000..ae91411332 --- /dev/null +++ b/variants/STM32G0xx/Generic_G030Kx/variant_AURORA_ONE.h @@ -0,0 +1,120 @@ +/* + ******************************************************************************* + * Copyright (c) 2020, 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_ALTR 27 +#define PA10_ALTR 28 +#define PA6_ALT0 29 +#define PA7_ALT0 30 +#define PA7_ALT1 31 +#define PA7_ALT2 32 +#define PB0_ALT0 33 +#define PB1_ALT0 34 +#define PB1_ALT1 35 +#define PB6_ALT0 36 +// #define PC14 37 // OSC32IN +// #define PC15 38 // OSC32OUT + +// This must be a literal +#define NUM_DIGITAL_PINS 37 +#define NUM_ALTERNATE_PINS 8 +#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 */