Skip to content

Commit

Permalink
variant(WBA): add Nucleo WBA55CG support
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
  • Loading branch information
fpistm committed Feb 28, 2024
1 parent 2124d42 commit 93d8e59
Show file tree
Hide file tree
Showing 4 changed files with 297 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
| :green_heart: | STM32L452RE-P | [Nucleo L452RE-P](http://www.st.com/en/evaluation-tools/nucleo-l452re-p.html) | *1.8.0* | |
| :green_heart: | STM32L476RG | [Nucleo L476RG](http://www.st.com/en/evaluation-tools/nucleo-l476rg.html) | *0.1.0* | |
| :green_heart: | STM32WB15CCU | [Nucleo-WB15CC](https://www.st.com/en/evaluation-tools/nucleo-wb15cc.html) | *2.5.0* | |
| :yellow_heart: | STM32WBA55CGU | Nucleo-WBA55CG | **2.8.0** | |
| :green_heart: | STM32WB55RG | [P-Nucleo-WB55RG](https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html) | *1.6.0* | BLE support with [STM32duinoBLE](https://github.com/stm32duino/STM32duinoBLE) |
| :green_heart: | STM32WB55CG | [P-Nucleo-WB55 USB Dongle](https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html) | *2.5.0* | BLE support with [STM32duinoBLE](https://github.com/stm32duino/STM32duinoBLE) |
| :green_heart: | STM32WL55JC | [Nucleo WL55JC1](https://www.st.com/en/evaluation-tools/nucleo-wl55jc.html) | *2.1.0* | LoRa support not available |
Expand Down
13 changes: 13 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,19 @@ Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.series=STM32WBxx
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.product_line=STM32WB55xx
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.variant=STM32WBxx/WB35C(C-E)UxA_WB55C(C-E-G)U

# NUCLEO WBA55CG
Nucleo_64.menu.pnum.NUCLEO_WBA55CG=Nucleo WBA55CG
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.node="NOD_WBA52CG,NOD_WBA55CG"
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.upload.maximum_size=1048576
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.upload.maximum_data_size=131072
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.build.mcu=cortex-m33
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.build.fpu=-mfpu=fpv4-sp-d16
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.build.float-abi=-mfloat-abi=hard
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.build.board=NUCLEO_WBA55CG
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.build.series=STM32WBAxx
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.build.product_line=STM32WBA55xx
Nucleo_64.menu.pnum.NUCLEO_WBA55CG.build.variant=STM32WBAxx/WBA55C(E-G)U

# NUCLEO_WL55JC1 board
Nucleo_64.menu.pnum.NUCLEO_WL55JC1=Nucleo WL55JC1
Nucleo_64.menu.pnum.NUCLEO_WL55JC1.node="NOD_WL55JC"
Expand Down
138 changes: 138 additions & 0 deletions variants/STM32WBAxx/WBA55C(E-G)U/variant_NUCLEO_WBA55CG.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*
*******************************************************************************
* Copyright (c) 2023, 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_NUCLEO_WBA55CG)
#include "pins_arduino.h"

// Digital PinName array
const PinName digitalPin[] = {
PA_10, //D0
PB_5, //D1
PB_7, //D2
PB_6, //D3
PA_11, //D4
PB_14, //D5
PB_0, //D6
PB_9, //D7/A7
PB_15, //D8
PA_9, //D9
PA_12, //D10
PA_15, //D11
PB_3, //D12
PB_4, //D13
PB_1, //D14
PB_2, //D15
PA_7, //D16/A0
PA_6, //D17/A1
PA_2, //D18/A2
PA_1, //D19/A3
PA_5, //D20/A4
PA_0, //D21/A5
PB_8, //D22
PC_13, //D23
PB_12, //D24
PA_8, //D25
PC_15, //D26
PC_14, //D27
PA_14, //D28
PA_13, //D29
PH_3 //D30
};

// Analog (Ax) pin number array
const uint32_t analogInputPin[] = {
16, // A0, PA7
17, // A1, PA6
18, // A2, PA2
19, // A3, PA1
20, // A4, PA5
21, // A5, PA0
7 // A6, PB9
};

// ----------------------------------------------------------------------------
#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 PeriphClkInit = {};

/** Configure the main internal regulator output voltage
*/
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) {
Error_Handler();
}

/** Configure LSE Drive Capability
*/
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_MEDIUMLOW);

/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE
| RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSEDiv = RCC_HSE_DIV1;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL1.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL1.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL1.PLLM = 2;
RCC_OscInitStruct.PLL1.PLLN = 12;
RCC_OscInitStruct.PLL1.PLLP = 2;
RCC_OscInitStruct.PLL1.PLLQ = 2;
RCC_OscInitStruct.PLL1.PLLR = 2;
RCC_OscInitStruct.PLL1.PLLFractional = 4096;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}

/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2
| RCC_CLOCKTYPE_PCLK7 | RCC_CLOCKTYPE_HCLK5;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB7CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.AHB5_PLL1_CLKDivider = RCC_SYSCLK_PLL1_DIV4;
RCC_ClkInitStruct.AHB5_HSEHSI_CLKDivider = RCC_SYSCLK_HSEHSI_DIV1;

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK) {
Error_Handler();
}
/** Initializes the peripherals clock
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_LPUART1;
PeriphClkInit.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_HSI;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
Error_Handler();
}
}

#ifdef __cplusplus
}
#endif
#endif /* ARDUINO_NUCLEO_WBA55CG* */
145 changes: 145 additions & 0 deletions variants/STM32WBAxx/WBA55C(E-G)U/variant_NUCLEO_WBA55CG.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/*
*******************************************************************************
* Copyright (c) 2023, 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
*----------------------------------------------------------------------------*/
#define PA10 0
#define PB5 1
#define PB7 2 // B2
#define PB6 3 // B3
#define PA11 4
#define PB14 5
#define PB0 6
#define PB9 PIN_A6
#define PB15 8
#define PA9 9 // LED2 (default not connected SB28 off)
#define PA12 10
#define PA15 11
#define PB3 12
#define PB4 13 // LED1
#define PB1 14
#define PB2 15

#define PA7 PIN_A0
#define PA6 PIN_A1
#define PA2 PIN_A2
#define PA1 PIN_A3
#define PA5 PIN_A4
#define PA0 PIN_A5

#define PB8 22 // LED3
#define PC13 23 // B1
#define PB12 24 // VCP1_TX
#define PA8 25 // VCP1_RX
#define PC15 26 // OSC32_IN
#define PC14 27 // OSC32_OUT
#define PA14 28 // SWCLK
#define PA13 29 // SWDIO
#define PH3 30 // BOOT0

// Alternate pins number
#define PA0_ALT1 (PA0 | ALT1)
#define PA1_ALT1 (PA1 | ALT1)
#define PA1_ALT2 (PA1 | ALT2)
#define PA2_ALT1 (PA2 | ALT1)
#define PB1_ALT1 (PB1 | ALT1)
#define PB2_ALT1 (PB2 | ALT1)
#define PB3_ALT1 (PB3 | ALT1)
#define PB4_ALT1 (PB4 | ALT1)
#define PB8_ALT1 (PB8 | ALT1)
#define PB9_ALT1 (PB9 | ALT1)
#define PB9_ALT2 (PB9 | ALT2)
#define PB15_ALT1 (PB15 | ALT1)

#define NUM_DIGITAL_PINS 31
#define NUM_ANALOG_INPUTS 7

// On-board LED pin number
#define LED1 PB4
#define LED2 PA9
#define LED3 PB8
#ifndef LED_BUILTIN
#define LED_BUILTIN LED1
#endif
#define LED_BLUE LED1
#define LED_GREEN LED2
#define LED_RED LED3

// On-board user button
#define B1_BTN PC13
#define B2_BTN PB6
#define B3_BTN PB7
#ifndef USER_BTN
#define USER_BTN B1_BTN
#endif

// 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 1
#endif

// Default pin used for generic 'Serial' instance
// Mandatory for Firmata
#ifndef PIN_SERIAL_RX
#define PIN_SERIAL_RX PA8
#endif
#ifndef PIN_SERIAL_TX
#define PIN_SERIAL_TX PB12
#endif

// Alternate SYS_WKUP definition
#define PWR_WAKEUP_PIN1_1
#define PWR_WAKEUP_PIN3_1
#define PWR_WAKEUP_PIN4_1
#define PWR_WAKEUP_PIN6_1
#define PWR_WAKEUP_PIN7_1
#define PWR_WAKEUP_PIN8_1

/*----------------------------------------------------------------------------
* 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.
#ifndef SERIAL_PORT_MONITOR
#define SERIAL_PORT_MONITOR Serial
#endif
#ifndef SERIAL_PORT_HARDWARE
#define SERIAL_PORT_HARDWARE Serial
#endif
#endif

0 comments on commit 93d8e59

Please sign in to comment.