diff --git a/targets/TARGET_STM/TARGET_STM32H5/CMakeLists.txt b/targets/TARGET_STM/TARGET_STM32H5/CMakeLists.txt index c115e32f642..2e01b2e7aef 100644 --- a/targets/TARGET_STM/TARGET_STM32H5/CMakeLists.txt +++ b/targets/TARGET_STM/TARGET_STM32H5/CMakeLists.txt @@ -9,9 +9,10 @@ add_library(mbed-stm32h5 INTERFACE) target_sources(mbed-stm32h5 INTERFACE - gpio_irq_device.c - serial_device.c clock_cfg/system_clock.c + gpio_irq_device.c + serial_device.c + pwmout_device.c ) target_include_directories(mbed-stm32h5 diff --git a/targets/TARGET_STM/TARGET_STM32H5/TARGET_STM32H503xB/TARGET_NUCLEO_H503RB/PeripheralPins.c b/targets/TARGET_STM/TARGET_STM32H5/TARGET_STM32H503xB/TARGET_NUCLEO_H503RB/PeripheralPins.c index 2aca70b2288..a285e80b8e6 100644 --- a/targets/TARGET_STM/TARGET_STM32H5/TARGET_STM32H503xB/TARGET_NUCLEO_H503RB/PeripheralPins.c +++ b/targets/TARGET_STM/TARGET_STM32H5/TARGET_STM32H503xB/TARGET_NUCLEO_H503RB/PeripheralPins.c @@ -105,73 +105,73 @@ MBED_WEAK const PinMap PinMap_I2C_SCL[] = { //*** PWM *** -// TIM2 cannot be used because already used by the us_ticker +// TIM3 cannot be used because already used by the us_ticker MBED_WEAK const PinMap PinMap_PWM[] = { - //{PA_0, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 - {PA_0, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PA_0, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + //{PA_0, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 {PA_1, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM1, 3, 0)}, // TIM1_CH3 - //{PA_1, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PA_1, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 {PA_2, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM1, 4, 0)}, // TIM1_CH4 - //{PA_2, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PA_2, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 {PA_3, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM1, 1, 1)}, // TIM1_CH1N // Connected to STDIO_UART_RX - //{PA_3, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 // Connected to STDIO_UART_RX + {PA_3, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 // Connected to STDIO_UART_RX {PA_4, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N // Connected to STDIO_UART_TX {PA_5, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 // Connected to USER_LED - {PA_6, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + //{PA_6, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 {PA_7, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N - //{PA_7, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM2, 3, 0)}, // TIM2_CH3 - {PA_7, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PA_7, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM2, 3, 0)}, // TIM2_CH3 + //{PA_7, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 {PA_8, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 {PA_8, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM1, 4, 1)}, // TIM1_CH4N - {PA_8, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + //{PA_8, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 {PA_9, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 // Connected to USB_FS_VBUS {PA_10, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 {PA_11, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 // Connected to USB_FS_DN - {PA_11, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 // Connected to USB_FS_DN - //{PA_12, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM2, 4, 0)}, // TIM2_CH4 // Connected to USB_FS_DP - {PA_12, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 // Connected to USB_FS_DP - {PA_13, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_LPTIM1, 1, 0)}, // TIM1_CH1 // Connected to T_SWDIO + //{PA_11, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 // Connected to USB_FS_DN + {PA_12, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM2, 4, 0)}, // TIM2_CH4 // Connected to USB_FS_DP + //{PA_12, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 // Connected to USB_FS_DP + //{PA_13, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_LPTIM1, 1, 0)}, // TIM1_CH1 // Connected to T_SWDIO {PA_14, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 // Connected to T_SWCLK {PA_14, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM1, 4, 1)}, // TIM1_CH4N // Connected to T_SWCLK - {PA_14, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 // Connected to T_SWCLK + //{PA_14, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 // Connected to T_SWCLK //{PA_15, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF3_LPTIM2, 1, 0)}, // TIM2_CH1 // Connected to T_JTDI {PB_0, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N - {PB_0, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + //{PB_0, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 {PB_1, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM1, 1, 0)}, // TIM1_CH1 {PB_1, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N - {PB_1, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + //{PB_1, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 {PB_2, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N - //{PB_2, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM2, 1, 0)}, // TIM2_CH1 - //{PB_3, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 // Connected to T_SWO - {PB_4, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_LPTIM1, 2, 0)}, // TIM1_CH2 + {PB_2, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM2, 1, 0)}, // TIM2_CH1 + {PB_3, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 // Connected to T_SWO + //{PB_4, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_LPTIM1, 2, 0)}, // TIM1_CH2 {PB_4, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 4, 1)}, // TIM1_CH4N - {PB_4, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + //{PB_4, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 {PB_5, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 - {PB_5, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + //{PB_5, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 {PB_6, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM1, 2, 0)}, // TIM1_CH2 {PB_6, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N - {PB_6, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + //{PB_6, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 {PB_7, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM1, 1, 0)}, // TIM1_CH1 {PB_7, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N - //{PB_10, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_10, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 {PB_13, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N {PB_14, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N // Connected to ARD_D1_TX {PB_15, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N // Connected to ARD_D0_RX - {PB_15, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM3, 4, 0)}, // TIM3_CH4 // Connected to ARD_D0_RX - //{PC_4, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + //{PB_15, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM3, 4, 0)}, // TIM3_CH4 // Connected to ARD_D0_RX + {PC_4, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 {PC_5, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 4, 1)}, // TIM1_CH4N {PC_6, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 - {PC_6, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + //{PC_6, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 {PC_7, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 - {PC_7, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + //{PC_7, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 {PC_8, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 - {PC_8, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + //{PC_8, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 {PC_9, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 - {PC_9, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 - //{PC_11, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + //{PC_9, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PC_11, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 {PC_12, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_TIM1, 4, 0)}, // TIM1_CH4 - //{PC_12, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 - //{PD_2, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 // Connected to USB_FS_OVCR + {PC_12, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PD_2, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 // Connected to USB_FS_OVCR {NC, NC, 0} }; diff --git a/targets/TARGET_STM/TARGET_STM32H5/objects.h b/targets/TARGET_STM/TARGET_STM32H5/objects.h index 055551bf4c8..94b1e398f8e 100644 --- a/targets/TARGET_STM/TARGET_STM32H5/objects.h +++ b/targets/TARGET_STM/TARGET_STM32H5/objects.h @@ -51,16 +51,6 @@ struct trng_s { RNG_HandleTypeDef handle; }; -struct pwmout_s { - PWMName pwm; - PinName pin; - uint32_t prescaler; - uint32_t period; - uint32_t pulse; - uint8_t channel; - uint8_t inverted; -}; - struct spi_s { SPI_HandleTypeDef handle; IRQn_Type spiIRQ; diff --git a/targets/TARGET_STM/TARGET_STM32H5/pwmout_device.c b/targets/TARGET_STM/TARGET_STM32H5/pwmout_device.c new file mode 100644 index 00000000000..6bf602c45eb --- /dev/null +++ b/targets/TARGET_STM/TARGET_STM32H5/pwmout_device.c @@ -0,0 +1,56 @@ +/* mbed Microcontroller Library + * SPDX-License-Identifier: BSD-3-Clause + ****************************************************************************** + * + * Copyright (c) 2015-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 + * + ****************************************************************************** + */ + +#include "cmsis.h" +#include "pwmout_api.h" +#include "pwmout_device.h" + +#if DEVICE_PWMOUT + +const pwm_apb_map_t pwm_apb_map_table[] = { + {PWM_1, PWMOUT_ON_APB1}, + {PWM_2, PWMOUT_ON_APB1}, + {PWM_3, PWMOUT_ON_APB2}, +#if defined(TIM4_BASE) +{PWM_4, PWMOUT_ON_APB2}, +#endif +#if defined(TIM5_BASE) +{PWM_5, PWMOUT_ON_APB1}, +#endif +#if defined(TIM8_BASE) +{PWM_8, PWMOUT_ON_APB2}, +#endif +#if defined(TIM12_BASE) +{PWM_12, PWMOUT_ON_APB1}, +#endif +#if defined(TIM13_BASE) +{PWM_13, PWMOUT_ON_APB2}, +#endif +#if defined(TIM14_BASE) +{PWM_14, PWMOUT_ON_APB1}, +#endif +#if defined(TIM15_BASE) +{PWM_15, PWMOUT_ON_APB2}, +#endif +#if defined(TIM16_BASE) +{PWM_16, PWMOUT_ON_APB1}, +#endif +#if defined(TIM17_BASE) +{PWM_17, PWMOUT_ON_APB2}, +#endif + {(PWMName) 0, PWMOUT_UNKNOWN} +}; + +#endif // DEVICE_PWMOUT diff --git a/targets/TARGET_STM/TARGET_STM32H5/pwmout_device.h b/targets/TARGET_STM/TARGET_STM32H5/pwmout_device.h new file mode 100644 index 00000000000..55f61d5630d --- /dev/null +++ b/targets/TARGET_STM/TARGET_STM32H5/pwmout_device.h @@ -0,0 +1,47 @@ +/* mbed Microcontroller Library + * SPDX-License-Identifier: BSD-3-Clause + ****************************************************************************** + * + * Copyright (c) 2015-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 + * + ****************************************************************************** + */ + +#ifndef MBED_PWMOUT_DEVICE_H +#define MBED_PWMOUT_DEVICE_H + +#include "cmsis.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if DEVICE_PWMOUT + +typedef enum { + PWMOUT_ON_APB1 = 0, + PWMOUT_ON_APB2 = 1, + PWMOUT_UNKNOWN = 2 +} PwmoutApb; + +/* Structure to describe Timers to APB */ +typedef struct pwm_apb_map { + PWMName pwm; // an index entry for each EXIT line + PwmoutApb pwmoutApb; +} pwm_apb_map_t; + +extern const pwm_apb_map_t pwm_apb_map_table[]; + +#endif // DEVICE_PWMOUT + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/targets/TARGET_STM/TARGET_STM32H5/us_ticker_data.h b/targets/TARGET_STM/TARGET_STM32H5/us_ticker_data.h index cda3076ef8f..f75f1327f58 100644 --- a/targets/TARGET_STM/TARGET_STM32H5/us_ticker_data.h +++ b/targets/TARGET_STM/TARGET_STM32H5/us_ticker_data.h @@ -25,15 +25,15 @@ extern "C" { #include "cmsis_nvic.h" -#define TIM_MST TIM2 -#define TIM_MST_IRQ TIM2_IRQn -#define TIM_MST_RCC __TIM2_CLK_ENABLE() -#define TIM_MST_DBGMCU_FREEZE __HAL_DBGMCU_FREEZE_TIM2() +#define TIM_MST TIM3 +#define TIM_MST_IRQ TIM3_IRQn +#define TIM_MST_RCC __TIM3_CLK_ENABLE() +#define TIM_MST_DBGMCU_FREEZE __HAL_DBGMCU_FREEZE_TIM3() -#define TIM_MST_RESET_ON __TIM2_FORCE_RESET() -#define TIM_MST_RESET_OFF __TIM2_RELEASE_RESET() +#define TIM_MST_RESET_ON __TIM3_FORCE_RESET() +#define TIM_MST_RESET_OFF __TIM3_RELEASE_RESET() -#define TIM_MST_BIT_WIDTH 32 // 16 or 32 +#define TIM_MST_BIT_WIDTH 16 // 16 or 32 #define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)*/ diff --git a/targets/TARGET_STM/i2c_api.c b/targets/TARGET_STM/i2c_api.c index 1cdf9cb0fdf..a355efe4a84 100644 --- a/targets/TARGET_STM/i2c_api.c +++ b/targets/TARGET_STM/i2c_api.c @@ -2350,6 +2350,25 @@ uint32_t i2c_get_timing(I2CName i2c, uint32_t current_timing, int current_hz, break; } break; +#endif +#if defined (I2C_PCLK_250M) + case I2C_PCLK_250M: + switch (hz) { + case 100000: + tim = TIMING_VAL_250M_CLK_100KHZ; + break; + case 400000: + tim = TIMING_VAL_250M_CLK_400KHZ; + break; + case 1000000: + tim = TIMING_VAL_250M_CLK_1MHZ; + break; + default: + MBED_ASSERT((hz == 100000) || (hz == 400000) || \ + (hz == 1000000)); + break; + } + break; #endif default: /* If MBED_CONF_TARGET_I2C_TIMING_VALUE_ALGO assert is triggered. diff --git a/targets/targets.json5 b/targets/targets.json5 index 8c59f7ae9fe..0da6094070e 100644 --- a/targets/targets.json5 +++ b/targets/targets.json5 @@ -3098,7 +3098,6 @@ "ANALOGOUT", "ANALOGIN", "FLASH", - "PWMOUT", "LPTICKER", "CAN", "SERIAL_FC",