Skip to content

Commit

Permalink
variant(u0): add Nucleo U083RC support
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Aug 28, 2024
1 parent 83855c9 commit 813fb6a
Show file tree
Hide file tree
Showing 4 changed files with 362 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
| :green_heart: | STM32L452RE | [Nucleo L452RE](http://www.st.com/en/evaluation-tools/nucleo-l452re.html) | *1.5.0* | |
| :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* | |
| :yellow_heart: | STM32U083RC | [Nucleo U083RC](http://www.st.com/en/evaluation-tools/nucleo-u083rc.html) | **2.9.0** | |
| :green_heart: | STM32WB15CCU | [Nucleo-WB15CC](https://www.st.com/en/evaluation-tools/nucleo-wb15cc.html) | *2.5.0* | |
| :green_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) |
Expand Down
14 changes: 14 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,20 @@ Nucleo_64.menu.pnum.NUCLEO_L476RG.build.variant=STM32L4xx/L475R(C-E-G)T_L476R(C-
Nucleo_64.menu.pnum.NUCLEO_L476RG.debug.server.openocd.scripts.2=target/stm32l4x.cfg
Nucleo_64.menu.pnum.NUCLEO_L476RG.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32L4xx/STM32L476.svd

# NUCLEO_U083RC board
Nucleo_64.menu.pnum.NUCLEO_U083RC=Nucleo U083RC
Nucleo_64.menu.pnum.NUCLEO_U083RC.node=NOD_U083RC
Nucleo_64.menu.pnum.NUCLEO_U083RC.upload.maximum_size=262144
Nucleo_64.menu.pnum.NUCLEO_U083RC.upload.maximum_data_size=40960
Nucleo_64.menu.pnum.NUCLEO_U083RC.build.mcu=cortex-m0plus
Nucleo_64.menu.pnum.NUCLEO_U083RC.build.board=NUCLEO_U083RC
Nucleo_64.menu.pnum.NUCLEO_U083RC.build.series=STM32U0xx
Nucleo_64.menu.pnum.NUCLEO_U083RC.build.product_line=STM32U083xx
Nucleo_64.menu.pnum.NUCLEO_U083RC.build.variant=STM32U0xx/U073R(8-B-C)(I-T)_U083RC(I-T)
Nucleo_64.menu.pnum.NUCLEO_U083RC.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -D__CORTEX_SC=0
Nucleo_64.menu.pnum.NUCLEO_U083RC.debug.server.openocd.scripts.2=target/stm32u0x.cfg
Nucleo_64.menu.pnum.NUCLEO_U083RC.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32U0xx/STM32U083.svd

# NUCLEO_WB15CC
Nucleo_64.menu.pnum.NUCLEO_WB15CC=Nucleo WB15CC
Nucleo_64.menu.pnum.NUCLEO_WB15CC.node="NOD_WB15CC"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/*
*******************************************************************************
* Copyright (c) 2024, 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_U083RC)
#include "pins_arduino.h"

// Digital PinName array
const PinName digitalPin[] = {
PA_3, // D0
PA_2, // D1
PA_10, // D2
PB_3, // D3
PB_5, // D4
PB_4, // D5
PB_10, // D6
PA_8, // D7
PA_9, // D8
PC_7, // D9
PB_6, // D10/A6
PA_7, // D11/A7
PA_6, // D12/A8
PA_5, // D13
PB_9, // D14
PB_8, // D15
PA_0, // D16/A0
PA_1, // D17/A1
PA_4, // D18/A2
PB_0, // D19/A3
PC_1, // D20/A4
PC_0, // D21/A5
PC_10, // D22
PC_12, // D23
PA_13, // D24
PA_14, // D25
PA_15, // D26
PB_7, // D27
PC_13, // D28
PC_14, // D29
PC_15, // D30
PF_0, // D31
PF_1, // D32
PC_2, // D33/A9
PC_3, // D34/A10
PC_11, // D35
PD_2, // D36
PC_9, // D37
PC_8, // D38
PC_6, // D39/A11
PC_5, // D40
PA_12, // D41
PA_11, // D42
PB_12, // D43
PB_11, // D44
PB_2, // D45
PB_1, // D46/A12
PB_15, // D47
PB_14, // D48
PB_13, // D49
PC_4, // D50/A13
PF_2, // D51
PF_3 // D52
};

// Analog (Ax) pin number array
const uint32_t analogInputPin[] = {
16, // A0, PA0
17, // A1, PA1
18, // A2, PA4
19, // A3, PB0
20, // A4, PC1
21, // A5, PC0
11, // A6, PA7
12, // A7, PA6
13, // A8, PA5
33, // A9, PC2
34, // A10, PC3
40, // A11, PC5
46, // A12, PB1
50 // A13, PC4
};

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

#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
*/
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_OSCILLATORTYPE_HSI48;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
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 = 7;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_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();
}

/** Initializes the peripherals clocks
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_LPUART1 | RCC_PERIPHCLK_LPUART2
| RCC_PERIPHCLK_LPUART3 | RCC_PERIPHCLK_USB;
PeriphClkInit.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_HSI;
PeriphClkInit.Lpuart2ClockSelection = RCC_LPUART2CLKSOURCE_HSI;
PeriphClkInit.Lpuart3ClockSelection = RCC_LPUART3CLKSOURCE_HSI;
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;


if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
Error_Handler();
}


}

#ifdef __cplusplus
}
#endif
#endif /* ARDUINO_NUCLEO_U083RC */
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
/*
*******************************************************************************
* Copyright (c) 2024, 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 PA3 0 // Rx
#define PA2 1 // Tx
#define PA10 2
#define PB3 3
#define PB5 4
#define PB4 5
#define PB10 6
#define PA8 7
#define PA9 8
#define PC7 9
#define PB6 10
#define PA7 PIN_A6
#define PA6 PIN_A7
#define PA5 PIN_A8
#define PB9 14
#define PB8 15
#define PA0 PIN_A0
#define PA1 PIN_A1
#define PA4 PIN_A2
#define PB0 PIN_A3
#define PC1 PIN_A4
#define PC0 PIN_A5
// Morpho
// CN7 Left Side
#define PC10 22
#define PC12 23
#define PA13 24 // SWDIO - NC by default SB15 off
#define PA14 25 // SWCLK - NC by default SB17 off
#define PA15 26
#define PB7 27
#define PC13 28 // USER_BTN
#define PC14 29 // OSC32_IN - NC by default SB22 off
#define PC15 30 // OSC32_OUT - NC by default SB24 off
#define PF0 31
#define PF1 32
#define PC2 PIN_A9
#define PC3 PIN_A10
// CN7 Right Side
#define PC11 35
#define PD2 36
// CN10 Left Side
#define PC9 37
// CN10 Right Side
#define PC8 38
#define PC6 39
#define PC5 PIN_A11
#define PA12 41
#define PA11 42
#define PB12 43
#define PB11 44
#define PB2 45
#define PB1 PIN_A12
#define PB15 47
#define PB14 48
#define PB13 49
#define PC4 PIN_A13
// Other
#define PF2 51 // NRST
#define PF3 52 // BOOT0

// Alternate pins number
#define PA1_ALT1 (PA1 | ALT1)
#define PA2_ALT1 (PA2 | ALT1)
#define PA3_ALT1 (PA3 | ALT1)
#define PA4_ALT1 (PA4 | ALT1)
#define PA6_ALT1 (PA6 | ALT1)
#define PA7_ALT1 (PA7 | ALT1)
#define PA9_ALT1 (PA9 | ALT1)
#define PA10_ALT1 (PA10 | ALT1)
#define PA11_ALT1 (PA11 | ALT1)
#define PA12_ALT1 (PA12 | ALT1)
#define PA15_ALT1 (PA15 | ALT1)
#define PB0_ALT1 (PB0 | ALT1)
#define PB1_ALT1 (PB1 | ALT1)
#define PB1_ALT2 (PB1 | ALT2)
#define PB3_ALT1 (PB3 | ALT1)
#define PB4_ALT1 (PB4 | ALT1)
#define PB5_ALT1 (PB5 | ALT1)
#define PB6_ALT1 (PB6 | ALT1)
#define PB6_ALT2 (PB6 | ALT2)
#define PB7_ALT1 (PB7 | ALT1)
#define PB7_ALT2 (PB7 | ALT2)
#define PB8_ALT1 (PB8 | ALT1)
#define PB9_ALT1 (PB9 | ALT1)
#define PB10_ALT1 (PB10 | ALT1)
#define PB11_ALT1 (PB11 | ALT1)
#define PB13_ALT1 (PB13 | ALT1)
#define PB14_ALT1 (PB14 | ALT1)
#define PB15_ALT1 (PB15 | ALT1)
#define PC0_ALT1 (PC0 | ALT1)
#define PC1_ALT1 (PC1 | ALT1)
#define PC4_ALT1 (PC4 | ALT1)
#define PC5_ALT1 (PC5 | ALT1)
#define PC10_ALT1 (PC10 | ALT1)
#define PC11_ALT1 (PC11 | ALT1)

#define NUM_DIGITAL_PINS 53
#define NUM_ANALOG_INPUTS 14

// On-board LED pin number
#ifndef LED_BUILTIN
#define LED_BUILTIN PA5
#endif
#ifndef LED_GREEN
#define LED_GREEN LED_BUILTIN
#endif


// On-board user button
#ifndef USER_BTN
#define USER_BTN PC13
#endif

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

// UART Definitions
#ifndef SERIAL_UART_INSTANCE
#define SERIAL_UART_INSTANCE 101
#endif

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

// Extra HAL modules
#if !defined(HAL_DAC_MODULE_DISABLED)
#define HAL_DAC_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.
#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 813fb6a

Please sign in to comment.