-
Notifications
You must be signed in to change notification settings - Fork 1k
variant(wb55): add STeaMi board #2526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+553
−2
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
transport select swd | ||
|
||
set ENABLE_LOW_POWER 1 | ||
set STOP_WATCHDOG 1 | ||
set CLOCK_FREQ 4000 | ||
|
||
reset_config none separate | ||
|
||
set CONNECT_UNDER_RESET 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
160 changes: 160 additions & 0 deletions
160
variants/STM32WBxx/WB55R(C-E-G)V/variant_STEAM32_WB55RG.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/* | ||
******************************************************************************* | ||
* 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 | ||
* | ||
******************************************************************************* | ||
*/ | ||
#include "variant_STEAM32_WB55RG.h" | ||
|
||
#if defined(ARDUINO_STEAM32_WB55RG) | ||
#include "lock_resource.h" | ||
#include "pins_arduino.h" | ||
|
||
// Pin number | ||
const PinName digitalPin[] = { | ||
PC_4, // P0/D0/A1 | ||
PA_5, // P1/D1/A3 | ||
PC_5, // P2/D2/A5 | ||
PA_2, // P3/D3/A0 | ||
PA_4, // P4/D4/A2 | ||
PA_7, // P5/D5 | ||
PC_3, // P6/D6 | ||
PA_9, // P7/D7 | ||
PA_15, // P8/D8 | ||
PC_2, // P9/D9 | ||
PA_6, // P10/D10/A4 | ||
PA_8, // P11/D11 | ||
PC_6, // P12/D12 | ||
PB_13, // P13/D13 | ||
PB_14, // P14/D14 | ||
PB_15, // P15/D15 | ||
PE_4, // P16/D16 | ||
PC_0, // P19/D17 | ||
PC_1, // P20/D18 | ||
PB_2, // D19 | ||
PD_0, // D20 | ||
PB_8, // D21 | ||
PB_9, // D22 | ||
PC_13, // D23 | ||
PB_12, // D24 | ||
PB_0, // D25 | ||
PD_1, // D26 | ||
PB_6, // D27 | ||
PB_7, // D28 | ||
PC_10, // D29 | ||
PH_3, // D30 | ||
PC_11, // D31 | ||
PC_12, // D32 | ||
PA_0, // D33 | ||
PA_3, // D34 | ||
PA_10, // D35 | ||
PA_12, // D36 | ||
PB_1, // D37 | ||
PB_10, // D38 | ||
PB_11, // D39 | ||
PA_11, // D40 | ||
PB_4, // D41 | ||
PB_5, // D42 | ||
PA_1, // D43 | ||
}; | ||
|
||
// Analog (Ax) pin number array | ||
const uint32_t analogInputPin[] = { | ||
3, // A0 | ||
0, // A1 | ||
4, // A2 | ||
1, // A3 | ||
10, // A4 | ||
2 // A5 | ||
}; | ||
|
||
// ---------------------------------------------------------------------------- | ||
#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 = {}; | ||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {}; | ||
|
||
/* This prevents concurrent access to RCC registers by CPU2 (M0+) */ | ||
hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY); | ||
|
||
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); | ||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); | ||
|
||
/* This prevents the CPU2 (M0+) to disable the HSI48 oscillator */ | ||
hsem_lock(CFG_HW_CLK48_CONFIG_SEMID, HSEM_LOCK_DEFAULT_RETRY); | ||
|
||
/* Initializes the CPU, AHB and APB busses clocks */ | ||
RCC_OscInitStruct.OscillatorType = | ||
RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_LSE; | ||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; | ||
RCC_OscInitStruct.LSEState = RCC_LSE_ON; | ||
RCC_OscInitStruct.HSIState = RCC_HSI_ON; | ||
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; | ||
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_DIV2; | ||
RCC_OscInitStruct.PLL.PLLN = 16; | ||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; | ||
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; | ||
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; | ||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { | ||
Error_Handler(); | ||
} | ||
|
||
/* Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers */ | ||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK4 | RCC_CLOCKTYPE_HCLK2 | RCC_CLOCKTYPE_HCLK | | ||
RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; | ||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSE; | ||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; | ||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; | ||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; | ||
RCC_ClkInitStruct.AHBCLK2Divider = RCC_SYSCLK_DIV1; | ||
RCC_ClkInitStruct.AHBCLK4Divider = RCC_SYSCLK_DIV1; | ||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) { | ||
Error_Handler(); | ||
} | ||
|
||
/* Initializes the peripherals clocks */ | ||
/* RNG needs to be configured like in M0 core, i.e. with HSI48 */ | ||
PeriphClkInitStruct.PeriphClockSelection = | ||
RCC_PERIPHCLK_SMPS | RCC_PERIPHCLK_RFWAKEUP | RCC_PERIPHCLK_RNG | RCC_PERIPHCLK_USB; | ||
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48; | ||
PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_HSI48; | ||
PeriphClkInitStruct.RFWakeUpClockSelection = RCC_RFWKPCLKSOURCE_LSE; | ||
PeriphClkInitStruct.SmpsClockSelection = RCC_SMPSCLKSOURCE_HSE; | ||
PeriphClkInitStruct.SmpsDivSelection = RCC_SMPSCLKDIV_RANGE1; | ||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { | ||
Error_Handler(); | ||
} | ||
|
||
LL_PWR_SMPS_SetStartupCurrent(LL_PWR_SMPS_STARTUP_CURRENT_80MA); | ||
LL_PWR_SMPS_SetOutputVoltageLevel(LL_PWR_SMPS_OUTPUT_VOLTAGE_1V40); | ||
LL_PWR_SMPS_Enable(); | ||
|
||
/* Select HSI as system clock source after Wake Up from Stop mode */ | ||
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI); | ||
|
||
hsem_unlock(CFG_HW_RCC_SEMID); | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif /* ARDUINO_STEAM32_WB55RG */ |
235 changes: 235 additions & 0 deletions
235
variants/STM32WBxx/WB55R(C-E-G)V/variant_STEAM32_WB55RG.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
/* | ||
******************************************************************************* | ||
* 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 | ||
* | ||
******************************************************************************* | ||
*/ | ||
#pragma once | ||
|
||
/*---------------------------------------------------------------------------- | ||
* STM32 pins number | ||
*----------------------------------------------------------------------------*/ | ||
|
||
// micro:bit Edge connector | ||
#define PC4 PIN_A1 | ||
#define PA5 PIN_A3 | ||
#define PC5 PIN_A5 | ||
#define PA2 PIN_A0 | ||
#define PA4 PIN_A2 | ||
#define PA7 5 | ||
#define PC3 6 | ||
#define PA9 7 | ||
#define PA15 8 | ||
#define PC2 9 | ||
#define PA6 PIN_A4 | ||
#define PA8 11 | ||
#define PC6 12 | ||
#define PB13 13 | ||
#define PB14 14 | ||
#define PB15 15 | ||
#define PE4 16 | ||
#define PC0 17 | ||
#define PC1 18 | ||
|
||
// Not on connectors | ||
#define PB2 19 | ||
#define PD0 20 | ||
#define PB8 21 | ||
#define PB9 22 | ||
#define PC13 23 | ||
#define PB12 24 | ||
#define PB0 25 | ||
#define PD1 26 | ||
#define PB6 27 | ||
#define PB7 28 | ||
#define PC10 29 | ||
#define PH3 30 | ||
#define PC11 31 | ||
#define PC12 32 | ||
#define PA0 33 | ||
#define PA3 34 | ||
#define PA10 35 | ||
#define PA12 36 | ||
#define PB1 37 | ||
#define PB10 38 | ||
#define PB11 39 | ||
#define PA11 40 | ||
#define PB4 41 | ||
#define PB5 42 | ||
#define PA1 43 | ||
|
||
#define NUM_DIGITAL_PINS 44 | ||
#define NUM_ANALOG_INPUTS 6 | ||
|
||
// GPIO expander | ||
// Not used by Arduino only here for documentation purpose | ||
// Upper pad | ||
// GPIO1 --> P28 | ||
// GPIO2 --> P29 | ||
// GPIO3 --> P24 | ||
// GPIO4 --> P25 | ||
|
||
// 4 directions switches | ||
// GPIO5 | ||
// GPIO6 | ||
// GPIO7 | ||
// GPIO8 | ||
|
||
// STeaMi's PinName | ||
#define ACTIVATE_3V3_STLINK PB2 | ||
#define CS_DISPLAY PD0 | ||
#define I2C_EXT_SCL PC0 | ||
#define I2C_EXT_SDA PC1 | ||
#define I2C_INT_SCL PB8 | ||
#define I2C_INT_SDA PB9 | ||
#define INT_ACC PC13 | ||
#define INT_DIST PB12 | ||
#define INT_EXPANDER PB0 | ||
#define INT_MAG PD1 | ||
#define JACDAC_DATA_TX PB6 | ||
#define JACDAC_DATA_RX PB7 | ||
#define MENU_BUTTON PA0 | ||
#define MIC_CLK PA3 | ||
#define MIC_IN PA10 | ||
|
||
#define P0 PC4 | ||
#define P1 PA5 | ||
#define P2 PC5 | ||
#define P3 PA2 | ||
#define P4 PA4 | ||
#define P5 PA7 | ||
#define P6 PC3 | ||
#define P7 PA9 | ||
#define P8 PA15 | ||
#define P9 PC2 | ||
#define P10 PA6 | ||
#define P11 PA8 | ||
#define P12 PC6 | ||
#define P13 PB13 | ||
#define P14 PB14 | ||
#define P15 PB15 | ||
#define P16 PE4 | ||
#define P19 PC1 | ||
#define P20 PC0 | ||
#define P24 GPIO3 | ||
#define P25 GPIO4 | ||
#define P28 GPIO1 | ||
#define P29 GPIO2 | ||
|
||
#define RST_DISPLAY PA12 | ||
#define RST_EXPANDER PB1 | ||
|
||
#define SERIAL_RX PB10 | ||
#define SERIAL_TX PB11 | ||
|
||
#define SPEAKER PA11 | ||
|
||
#define SPI_EXT_MISO PB14 | ||
#define SPI_EXT_MOSI PB15 | ||
#define SPI_EXT_SCK PB13 | ||
|
||
#define SPI_INT_MISO PB4 | ||
#define SPI_INT_MOSI PB5 | ||
#define SPI_INT_SCK PA1 | ||
|
||
// On-board LED pin number | ||
#define LED1 PC10 | ||
#define LED2 PC11 | ||
#define LED3 PC12 | ||
#define LED4 PH3 | ||
|
||
#ifndef LED_BUILTIN | ||
#define LED_BUILTIN LED1 | ||
#endif | ||
|
||
#define LED_BLUE LED1 | ||
#define LED_GREEN LED2 | ||
#define LED_RED LED3 | ||
|
||
#define LED_BLE LED4 | ||
|
||
// On-board user button | ||
#define A_BUTTON PA7 | ||
#define B_BUTTON PA8 | ||
#define MENU_BUTTON PA0 | ||
|
||
// DOWN_BUTTON --> GPIO6 | ||
// LEFT_BUTTON --> GPIO7 | ||
// RIGHT_BUTTON --> GPIO5 | ||
// UP_BUTTON --> GPIO8 | ||
|
||
#ifndef USER_BTN | ||
#define USER_BTN MENU_BUTTON | ||
#endif | ||
|
||
// SPI Definitions | ||
#define PIN_SPI_SS P16 | ||
#define PIN_SPI_MOSI SPI_EXT_MOSI | ||
#define PIN_SPI_MISO SPI_EXT_MISO | ||
#define PIN_SPI_SCK SPI_EXT_SCK | ||
|
||
// I2C Definitions | ||
#define PIN_WIRE_SDA I2C_EXT_SDA | ||
#define PIN_WIRE_SCL I2C_EXT_SCL | ||
|
||
// Timer Definitions | ||
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin | ||
#ifndef TIMER_TONE | ||
#define TIMER_TONE TIM16 | ||
#endif | ||
#ifndef TIMER_SERVO | ||
#define TIMER_SERVO TIM17 | ||
#endif | ||
|
||
// UART Definitions | ||
#ifndef SERIAL_UART_INSTANCE | ||
#define SERIAL_UART_INSTANCE 101 // Connected to ST-Link | ||
#endif | ||
|
||
// Default pin used for 'Serial' instance (ex: ST-Link) | ||
// Mandatory for Firmata | ||
#ifndef PIN_SERIAL_RX | ||
#define PIN_SERIAL_RX SERIAL_RX | ||
#endif | ||
#ifndef PIN_SERIAL_TX | ||
#define PIN_SERIAL_TX SERIAL_TX | ||
#endif | ||
|
||
// Only 512k provided for cpu1, so defined the FLASH_PAGE_NUMBER | ||
// for EEPROM emulation to the last 512k pages. | ||
#define FLASH_PAGE_NUMBER 127 | ||
|
||
// Extra HAL modules | ||
#if !defined(HAL_QSPI_MODULE_DISABLED) | ||
#define HAL_QSPI_MODULE_ENABLED | ||
#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 Serial1 | ||
#endif |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.