Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions system/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_hrtim.h
Original file line number Diff line number Diff line change
Expand Up @@ -1617,17 +1617,25 @@ typedef void (* pHRTIM_TIMxCallbackTypeDef)(HRTIM_HandleTypeDef *hhrtim, /*!<

/** @defgroup HRTIM_Deadtime_Prescaler_Ratio HRTIM Dead-time Prescaler Ratio
* @{
* @brief Constants defining division ratio between the timer clock frequency
* (fHRTIM) and the dead-time generator clock (fDTG)
* @brief Constants defining the prescaler value for the deadtime generator time step (tDTG) relative to the
* HR-Timer clock period (tHRTIM).
* @note A customer reported that the HRTIM deadtime prescaler defines in
* stm32g4xx_ll_hrtim.h were swapped between the multiplication (MUL) and
* division (DIV) settings (for example, MUL8 and DIV8 values were reversed).
* The legacy naming is intentionally kept for backward compatibility, even
* though it does not strictly match the reference manual. Renaming these
* constants would introduce a breaking API change, which may lead to
* incorrect deadtime programming and potential safety issues due to deadtime
* violations in existing applications.
*/
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV8 (0x00000000U) /*!< fDTG = fHRTIM / 8U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV4 (HRTIM_DTR_DTPRSC_0) /*!< fDTG = fHRTIM / 4U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV2 (HRTIM_DTR_DTPRSC_1) /*!< fDTG = fHRTIM / 2U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV1 (HRTIM_DTR_DTPRSC_1 | HRTIM_DTR_DTPRSC_0) /*!< fDTG = fHRTIM */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL2 (HRTIM_DTR_DTPRSC_2) /*!< fDTG = fHRTIM * 2U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL4 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_0) /*!< fDTG = fHRTIM * 4U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL8 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_1) /*!< fDTG = fHRTIM * 8U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL16 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_1 | HRTIM_DTR_DTPRSC_0) /*!< fDTG = fHRTIM * 16U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL8 (0x00000000U) /*!< tDTG = tHRTIM / 8U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL4 (HRTIM_DTR_DTPRSC_0) /*!< tDTG = tHRTIM / 4U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL2 (HRTIM_DTR_DTPRSC_1) /*!< tDTG = tHRTIM / 2U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV1 (HRTIM_DTR_DTPRSC_1 | HRTIM_DTR_DTPRSC_0) /*!< tDTG = tHRTIM */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV2 (HRTIM_DTR_DTPRSC_2) /*!< tDTG = tHRTIM * 2U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV4 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_0) /*!< tDTG = tHRTIM * 4U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV8 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_1) /*!< tDTG = tHRTIM * 8U */
#define HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV16 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_1 | HRTIM_DTR_DTPRSC_0) /*!< tDTG = tHRTIM * 16U */
/**
* @}
*/
Expand Down Expand Up @@ -3223,14 +3231,14 @@ typedef void (* pHRTIM_TIMxCallbackTypeDef)(HRTIM_HandleTypeDef *hhrtim, /*!<
((TIMEVENTLATCH) == HRTIM_TIMEVENTLATCH_ENABLED))

#define IS_HRTIM_TIMDEADTIME_PRESCALERRATIO(PRESCALERRATIO)\
(((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV8) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV4) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV2) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV1) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL2) || \
(((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL8) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL4) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL8) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL16))
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_MUL2) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV1) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV2) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV4) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV8) || \
((PRESCALERRATIO) == HRTIM_TIMDEADTIME_PRESCALERRATIO_DIV16))

#define IS_HRTIM_TIMDEADTIME_RISINGSIGN(RISINGSIGN)\
(((RISINGSIGN) == HRTIM_TIMDEADTIME_RISINGSIGN_POSITIVE) || \
Expand Down
77 changes: 46 additions & 31 deletions system/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_ll_hrtim.h
Original file line number Diff line number Diff line change
Expand Up @@ -1273,16 +1273,25 @@ static const uint32_t REG_MASK_TAB_CPT[] =

/** @defgroup HRTIM_LL_EC_DT_PRESCALER DEADTIME PRESCALER
* @{
* @brief Constants defining division ratio between the timer clock frequency (fHRTIM) and the deadtime generator clock (fDTG).
*/
#define LL_HRTIM_DT_PRESCALER_DIV8 0x00000000U /*!< fDTG = fHRTIM / 8 */
#define LL_HRTIM_DT_PRESCALER_DIV4 (HRTIM_DTR_DTPRSC_0) /*!< fDTG = fHRTIM / 4 */
#define LL_HRTIM_DT_PRESCALER_DIV2 (HRTIM_DTR_DTPRSC_1) /*!< fDTG = fHRTIM / 2 */
#define LL_HRTIM_DT_PRESCALER_DIV1 (HRTIM_DTR_DTPRSC_1 | HRTIM_DTR_DTPRSC_0) /*!< fDTG = fHRTIM */
#define LL_HRTIM_DT_PRESCALER_MUL2 (HRTIM_DTR_DTPRSC_2) /*!< fDTG = fHRTIM * 2 */
#define LL_HRTIM_DT_PRESCALER_MUL4 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_0) /*!< fDTG = fHRTIM * 4 */
#define LL_HRTIM_DT_PRESCALER_MUL8 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_1) /*!< fDTG = fHRTIM * 8 */
#define LL_HRTIM_DT_PRESCALER_MUL16 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_1 | HRTIM_DTR_DTPRSC_0) /*!< fDTG = fHRTIM * 16 */
* @brief Constants defining the prescaler value for the deadtime generator time step (tDTG) relative to the
* HR-Timer clock period (tHRTIM).
* @note A customer reported that the HRTIM deadtime prescaler defines in
* stm32g4xx_ll_hrtim.h were swapped between the multiplication (MUL) and
* division (DIV) settings (for example, MUL8 and DIV8 values were reversed).
* The legacy naming is intentionally kept for backward compatibility, even
* though it does not strictly match the reference manual. Renaming these
* constants would introduce a breaking API change, which may lead to
* incorrect deadtime programming and potential safety issues due to deadtime
* violations in existing applications.
*/
#define LL_HRTIM_DT_PRESCALER_MUL8 0x00000000U /*!< tDTG = tHRTIM / 8 */
#define LL_HRTIM_DT_PRESCALER_MUL4 (HRTIM_DTR_DTPRSC_0) /*!< tDTG = tHRTIM / 4 */
#define LL_HRTIM_DT_PRESCALER_MUL2 (HRTIM_DTR_DTPRSC_1) /*!< tDTG = tHRTIM / 2 */
#define LL_HRTIM_DT_PRESCALER_DIV1 (HRTIM_DTR_DTPRSC_1 | HRTIM_DTR_DTPRSC_0) /*!< tDTG = tHRTIM */
#define LL_HRTIM_DT_PRESCALER_DIV2 (HRTIM_DTR_DTPRSC_2) /*!< tDTG = tHRTIM * 2 */
#define LL_HRTIM_DT_PRESCALER_DIV4 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_0) /*!< tDTG = tHRTIM * 4 */
#define LL_HRTIM_DT_PRESCALER_DIV8 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_1) /*!< tDTG = tHRTIM * 8 */
#define LL_HRTIM_DT_PRESCALER_DIV16 (HRTIM_DTR_DTPRSC_2 | HRTIM_DTR_DTPRSC_1 | HRTIM_DTR_DTPRSC_0) /*!< tDTG = tHRTIM * 16 */
/**
* @}
*/
Expand Down Expand Up @@ -2836,7 +2845,8 @@ __STATIC_INLINE uint32_t LL_HRTIM_IsDisabledOutput(const HRTIM_TypeDef *HRTIMx,
* @arg @ref LL_HRTIM_ADCTRIG_SRC6810_TIMF_PER
* @retval None
*/
__STATIC_INLINE void LL_HRTIM_ConfigADCTrig(const HRTIM_TypeDef *HRTIMx, uint32_t ADCTrig, uint32_t Update, uint32_t Src)
__STATIC_INLINE void LL_HRTIM_ConfigADCTrig(const HRTIM_TypeDef *HRTIMx, uint32_t ADCTrig, uint32_t Update,
uint32_t Src)
{
__IO uint32_t *padcur = (__IO uint32_t *)((uint32_t)((uint32_t)(&HRTIMx->sCommonRegs.CR1) +
REG_OFFSET_TAB_ADCUR[ADCTrig]));
Expand Down Expand Up @@ -6133,7 +6143,8 @@ __STATIC_INLINE uint32_t LL_HRTIM_TIM_GetIdlePushPullStatus(const HRTIM_TypeDef

* @retval None
*/
__STATIC_INLINE void LL_HRTIM_TIM_SetEventFilter(const HRTIM_TypeDef *HRTIMx, uint32_t Timer, uint32_t Event, uint32_t Filter)
__STATIC_INLINE void LL_HRTIM_TIM_SetEventFilter(const HRTIM_TypeDef *HRTIMx, uint32_t Timer, uint32_t Event,
uint32_t Filter)
{
uint32_t iTimer = (uint8_t)(POSITION_VAL(Timer) - POSITION_VAL(LL_HRTIM_TIMER_A));
uint32_t iEvent = (uint8_t)(POSITION_VAL(Event) - POSITION_VAL(LL_HRTIM_EVENT_1));
Expand Down Expand Up @@ -6984,7 +6995,8 @@ __STATIC_INLINE uint32_t LL_HRTIM_TIM_IsEnabledDualDacTrigger(const HRTIM_TypeDe
* @param Threshold This parameter can be a number between Min_Data=0 and Max_Data=63
* @retval None
*/
__STATIC_INLINE void LL_HRTIM_TIM_SetEventCounterThreshold(const HRTIM_TypeDef *HRTIMx, uint32_t Timer, uint32_t EventCounter,
__STATIC_INLINE void LL_HRTIM_TIM_SetEventCounterThreshold(const HRTIM_TypeDef *HRTIMx, uint32_t Timer,
uint32_t EventCounter,
uint32_t Threshold)
{
uint32_t iTimer = (uint8_t)(POSITION_VAL(Timer) - POSITION_VAL(LL_HRTIM_TIMER_A));
Expand Down Expand Up @@ -7050,7 +7062,8 @@ __STATIC_INLINE uint32_t LL_HRTIM_TIM_GetEventCounterThreshold(const HRTIM_TypeD
* @arg @ref LL_HRTIM_EVENT_10
* @retval None
*/
__STATIC_INLINE void LL_HRTIM_TIM_SetEventCounterSource(const HRTIM_TypeDef *HRTIMx, uint32_t Timer, uint32_t EventCounter,
__STATIC_INLINE void LL_HRTIM_TIM_SetEventCounterSource(const HRTIM_TypeDef *HRTIMx, uint32_t Timer,
uint32_t EventCounter,
uint32_t Event)
{
uint32_t iTimer = (uint8_t)(POSITION_VAL(Timer) - POSITION_VAL(LL_HRTIM_TIMER_A));
Expand Down Expand Up @@ -7123,7 +7136,8 @@ __STATIC_INLINE uint32_t LL_HRTIM_TIM_GetEventCounterSource(const HRTIM_TypeDef
* @arg @ref LL_HRTIM_EE_COUNTER_RSTMODE_CONDITIONAL
* @retval None
*/
__STATIC_INLINE void LL_HRTIM_TIM_SetEventCounterResetMode(const HRTIM_TypeDef *HRTIMx, uint32_t Timer, uint32_t EventCounter,
__STATIC_INLINE void LL_HRTIM_TIM_SetEventCounterResetMode(const HRTIM_TypeDef *HRTIMx, uint32_t Timer,
uint32_t EventCounter,
uint32_t Mode)
{
uint32_t iTimer = (uint8_t)(POSITION_VAL(Timer) - POSITION_VAL(LL_HRTIM_TIMER_A));
Expand Down Expand Up @@ -7227,7 +7241,8 @@ __STATIC_INLINE void LL_HRTIM_TIM_EnableEventCounter(const HRTIM_TypeDef *HRTIMx
* @arg @ref LL_HRTIM_EE_COUNTER_B
* @retval None
*/
__STATIC_INLINE void LL_HRTIM_TIM_DisableEventCounter(const HRTIM_TypeDef *HRTIMx, uint32_t Timer, uint32_t EventCounter)
__STATIC_INLINE void LL_HRTIM_TIM_DisableEventCounter(const HRTIM_TypeDef *HRTIMx, uint32_t Timer,
uint32_t EventCounter)
{
uint32_t iTimer = (uint8_t)(POSITION_VAL(Timer) - POSITION_VAL(LL_HRTIM_TIMER_A));
__IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&HRTIMx->sTimerxRegs[iTimer].EEFxR3)));
Expand Down Expand Up @@ -7312,14 +7327,14 @@ __STATIC_INLINE void LL_HRTIM_DT_Config(const HRTIM_TypeDef *HRTIMx, uint32_t Ti
* @arg @ref LL_HRTIM_TIMER_E
* @arg @ref LL_HRTIM_TIMER_F
* @param Prescaler This parameter can be one of the following values:
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV8
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV4
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV2
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV1
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL2
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL4
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL8
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL16
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL4
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL2
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV1
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV2
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV4
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV8
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV16
* @retval None
*/
__STATIC_INLINE void LL_HRTIM_DT_SetPrescaler(const HRTIM_TypeDef *HRTIMx, uint32_t Timer, uint32_t Prescaler)
Expand All @@ -7342,14 +7357,14 @@ __STATIC_INLINE void LL_HRTIM_DT_SetPrescaler(const HRTIM_TypeDef *HRTIMx, uint3
* @arg @ref LL_HRTIM_TIMER_E
* @arg @ref LL_HRTIM_TIMER_F
* @retval Prescaler This parameter can be one of the following values:
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV8
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV4
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV2
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV1
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL2
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL4
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL8
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL16
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL4
* @arg @ref LL_HRTIM_DT_PRESCALER_MUL2
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV1
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV2
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV4
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV8
* @arg @ref LL_HRTIM_DT_PRESCALER_DIV16
*/
__STATIC_INLINE uint32_t LL_HRTIM_DT_GetPrescaler(const HRTIM_TypeDef *HRTIMx, uint32_t Timer)
{
Expand Down Expand Up @@ -10095,7 +10110,7 @@ __STATIC_INLINE uint32_t LL_HRTIM_FLT_IsEnabledBlanking(const HRTIM_TypeDef *HRT
{
uint32_t iFault = (uint8_t)POSITION_VAL(Fault);
const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&HRTIMx->sCommonRegs.FLTINR3) +
REG_OFFSET_TAB_FLTINR[iFault]));
REG_OFFSET_TAB_FLTINR[iFault]));
uint32_t temp; /* MISRAC-2012 compliance */
temp = READ_BIT(*pReg, (uint32_t)(HRTIM_FLTINR3_FLT1BLKE) << REG_SHIFT_TAB_FLTxE[iFault]) >> REG_SHIFT_TAB_FLTxE[iFault];

Expand Down
2 changes: 1 addition & 1 deletion system/Drivers/STM32G4xx_HAL_Driver/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 2 additions & 2 deletions system/Drivers/STM32G4xx_HAL_Driver/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# STM32CubeG4 HAL Driver MCU Component

![tag](https://img.shields.io/badge/tag-v1.2.6-brightgreen.svg)
![tag](https://img.shields.io/badge/tag-v1.2.7-brightgreen.svg)

## Overview

Expand Down Expand Up @@ -33,4 +33,4 @@ The full **STM32CubeG4** MCU package is available [here](https://github.com/STMi

## Troubleshooting

Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) guide.
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) guide.
Loading
Loading