# Release Notes for STM32G4xx HAL Drivers

Copyright © 2019 STMicroelectronics

# Purpose

The STM32Cube HAL and LL, an STM32 abstraction layer embedded software, ensure maximized portability across STM32 portfolio.

The Portable APIs layer provides a generic, multi instanced and simple set of APIs to interact with the upper layer (application, libraries and stacks). It is composed of native and extended APIs set. It is directly built around a generic architecture and allows the build-upon layers, like the middleware layer, to implement its functions without knowing in-depth the used STM32 device. This improves the library code reusability and guarantees an easy portability on other devices and STM32 families.

The Low Layer (LL) drivers are part of the STM32Cube firmware HAL that provide basic set of optimized and one shot services. The Low layer drivers, contrary to the HAL ones are not Fully Portable across the STM32 families; the availability of some functions depend on the physical availability of the relative features on the product. The Low Layer (LL) drivers are designed to offer the following features:

- New set of inline function for direct and atomic register access
- One-shot operations that can be used by the HAL drivers or from application level.
- Fully Independent from HAL and can be used in standalone usage (without HAL drivers)
- Full features coverage of the all the supported peripherals.

# Update History

V1.2.5 / 25-September-2024

## Main Changes

### Maintenance Release

- General updates to fix known defects and enhancements implementation.

- Code quality enhancment MISRA-C 2012.

- HAL DAC update
  - Improve management of connection selection vs buffer mode (add assert parameter check and comments).
- HAL FMAC update
  - Abort DMAIn/DMAOut in HAL_FMAC_FilterStop if configured.
- HAL I2S update
  - Update HAL I2S driver to remove ‘go to’ instruction.
- HAL SPI update
  - Check data size before changing state in reception API.
- HAL UART update
  - Correct DMA Rx abort procedure impact on ongoing Tx transfer in polling mode.
- HAL USART update
  - Improve the visibility of the SPI function support in HAL USART description.
- HAL USB update
  - Fix added to support bulk transfer in double buffer mode.
- LL UCPD update
  - Add LL UCPD API LL_UCPD_IsActiveFlag_RxErr().
  - Correct wording in some LL API LL_UCPD_IsActiveFlag_xxx function descriptions.

## Development Toolchains and Compilers

- IAR Embedded Workbench for ARM (EWARM) toolchain V8.50.9 + ST-LINKV2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.38 + ST-LINKV2
- STM32CubeIDE toolchain (gcc9_2020_q2_update) V1.14.0

## Supported Devices

- STM32G431/41xx
- STM32G471xx
- STM32G473/83xx
- STM32G474/84xx
- STM32G491/A1xx

V1.2.4 / 05-June-2024

## Main Changes

### Maintenance Release

- General updates to fix known defects and enhancements implementation.

- HAL DAC update
  - Update HAL_DACEx_SelfCalibrate() API to manage case of calibration factor equal to range maximum value.
- HAL CORTEX update
  - Update HAL_MPU_ConfigRegion() API to allow the configuration of the MPU registers independently of the value of Enable/Disable field.
  - Add new HAL_MPU_EnableRegion() / HAL_MPU_DisableRegion() APIs.
- HAL QSPI update
  - Clear AR register after CCR to avoid new transfer when address is not needed.
- HAL I2C update
  - Code quality enhancement MISRA-C 2012 Rule-13.5 within the HAL_I2C_Master_Abort_IT() API:
  - Add a temporary variable to get the value to check before comparison.
  - Add abort memory management to HAL_I2C_Master_Abort_IT() API.
  - Move the prefetch process in HAL_I2C_Slave_Transmit() API.
- HAL SPI update
  - HAL code quality enhancement for MISRA-C Rule-8.13 by adding const qualifiers..
- HAL/LL TIM update
  - Fixed typo in PWM asymmetric mode related constants.
- HAL UART update
  - Add HAL_UART_RXEVENT_IDLE event notification to user in case of HAL_UARTEx_ReceiveToIdle_DMA() use with Circular DMA, even if occurring just after TC event.
  - Align prescaler value used by default in UART_GET_DIV_FACTOR macro with RM.
  - Correct wrong comment in HAL_UARTEx_DisableFifoMode() API.
  - Ensure UART Rx buffer is not written beyond boundaries in case of RX FIFO reception in Interrupt mode.
- HAL USART update
  - Align prescaler value used by default in USART_GET_DIV_FACTOR macro with RM.
  - Correct wrong comment in HAL_USARTEx_DisableFifoMode() API.
  - Improve the visibility of the SPI mode support in HAL USART description.
- HAL CRYP update
  - Code quality enhancement MISRA-C 2012 Rule-10.4 within HAL_CRYP_IRQHandler() API.
- HAL FDCAN update
  - HAL code quality enhancement for MISRA-C Rule-8.13 by adding const qualifiers.
- LL BUS update
  - Update macro definition LL_AHB2_GRP1_PERIPH_CCM.
- LL LPUART update
  - Add LL_LPUART_RequestTxDataFlush() API allowing TX FIFO flush request.
- LL UCPD update
  - HAL code quality enhancement for MISRA-C Rule-8.13 by adding const qualifiers.
  - Fix typo in Doxygen sections.

## Development Toolchains and Compilers

- IAR Embedded Workbench for ARM (EWARM) toolchain V8.50.9 + ST-LINKV2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.38 + ST-LINKV2
- STM32CubeIDE toolchain (gcc9_2020_q2_update) V1.14.0

## Supported Devices

- STM32G431xx/41xx
- STM32G471xx
- STM32G473/83xx
- STM32G474/84xx
- STM32G491/A1xx

V1.2.3 / 15-December-2023

## Main Changes

### Maintenance Release

- HAL code quality enhancement for MISRA-C Rule-8.13 by adding const qualifiers.
- HAL Generic update
  - Add implementation of utility APIs HAL_GetUIDw0, HAL_GetUIDw1 and HAL_GetUIDw2.
  - Allow redefinition of macro UNUSED(x).
  - Update of HAL_GetTickFreq() brief.
- HAL/LL ADC update
  - Add “ADC_CHANNEL_0” in IS_ADC_CHANNEL() macro.
  - Add helper macro to convert data from differential mode.
  - Remove useless action of conversion trigger change in function LL_ADC_DeInit(); Moreover; this action was not compliant with ADC enable state (cf reference manual).
- HAL/LL TIM update
  - Manage configuration of the Capture/compare DMA request source:
    - Add related new exported constants (TIM_CCDMAREQUEST_CC, TIM_CCDMAREQUEST_UPDATE).
    - Create a new macro __HAL_TIM_SELECT_CCDMAREQUEST() allowing to program the TIMx_CR2.CCDS bitfield.
  - Remove useless definition of macro IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION.
  - Improve driver robustness against wrong period values.
  - Improve driver robustness against wrong DMA related parameters.
  - Improve period configuration parameter check.
  - Minor typo correction in hal_tim header file.
  - Update __LL_TIM_CALC_PSC() macro to round up the evaluated value when the fractional part of the division is greater than 0.5.
  - Remove useless check on IS_TIM_ADVANCED_INSTANCE() within LL_TIM_BDTR_Init() to fix Break Filter configuration problem with specific TIM instances.
  - Update LL_TIM_DisableBreakInputSource() and LL_TIM_SetBreakInputSourcePolarity() APIs description.
  - Remove lock management from callback management functions.
  - Remove multiple volatile reads or writes in interrupt handler for better performance.
  - Improve HAL TIM driver’s operational behavior.
  - Assert check for the right channels.
  - Fix typo in PWM symmetric mode related constants names.
  - Remove unnecessary change of MOE bitfield in LL_TIM_BDTR_Init().
- HAL/LL LPTIM update
  - Improve LPTIM FSM management consistency.
  - Apply same naming rules to clear FLAG related functions.
  - Remove Lock management from callback management functions.
  - Remove redundant IS_LPTIM_AUTORELOAD macro.
- HAL/LL RCC update
  - Add uint32_t cast to shift left operands constants defined with ‘U’ suffix in case MISRAC2012-Rule-12.2 violated.
  - Wait PLL1RDY to be off before clearing PLL1 source.
  - Set RCC_CRS_HSI48CALIBRATION_DEFAULT to 0x40 to be consistent with REFMAN and LL CRS driver.
  - Fix wrong RCC_APB1ENR1_WWDG2EN bit referenced in __HAL_RCC_WWDG_CLK_DISABLE() macro.
  - Modify the comment in PLL configuration.
- HAL CORTEX update
  - Updated HAL_MPU_ConfigRegion() to allow the configuration of the MPU registers independently of the value of Enable/Disable field.
  - Add new APIs HAL_MPU_EnableRegion() / HAL_MPU_DisableRegion().
- HAL DAC update
  - Fix incorrect word ‘surcharged’ in functions headers.
  - Updated DAC buffer calibration according to RM.
  - Fix HAL_GetTick() timeout vulnerability.
- HAL EXTI update
  - Fix computation of pExtiConfig->GPIOSel in HAL_EXTI_GetConfigLine().
  - Fix the wrong references in the “How to use this driver” section.
- HAL CORDIC update
  - Fix incorrect word ‘surcharged’ in functions headers.
- HAL FMAC update
  - Avoid usage of magic numbers.
  - Fix incorrect word ‘surcharged’ in functions headers.
- HAL/LL HRTIM update
  - Rework HAL_HRTIM_Get…() getter functions not to change the handle state in case input parameter is out-of-range.
  - Add a right shift of the read bit field in LL_HRTIM_FLT_GetResetMode() before returning the result.
  - Fix erroneous fault counter threshold configuration function.
  - Fix typo in LL_HRTIM_FLT_ResetCounter() API header.
- HAL RTC update
  - Check if the RTC calendar has been previously initialized before entering Initialization mode.
  - Optimize the way RSF flag is cleared in HAL_RTC_WaitForSynchro().
  - Correct misleading note about shadow registers.
- HAL FMC update
  - Fix Hardfault issues when executing NOR read operations caused by FMC_WRITE_OPERATION_DISABLE.
- HAL CRYP update
  - Mask arrays are declared as static const.
  - Update Crypt/Decrypt IT processes to avoid Computation Completed IRQ fires before the DINR pointer increment.
  - Update AES GCM in interrupt mode to avoid Computation Completed IRQ fires before the DINR pointer increment.
- HAL FLASH update
  - Update the hal_flash_ex.c file to correctly support the PB4_PUPEN Option.
  - Fix FLASH_PAGE_NB value for STM32G4 category 3 devices.
- HAL CRC update
  - Add filter in HAL_CRCEx_Polynomial_Set() to exclude even polynomials.
- HAL QSPI update
  - Update HAL_QSPI_Abort() and HAL_QSPI_Abort_IT() APIs to check on QSPI BUSY flag status before executing the abort procedure.
  - Fix incorrect word ‘surcharged’ in functions headers.
- HAL SMBUS update
  - Remove Lock management from callback management functions.
  - Update HAL SMBUS driver to prefetch data before starting the transmission: implementation of errata sheet workaround I2C2-190208 : Transmission stalled after first byte.
  - Update SMBUS_ITErrorHandler to flash TXDR just in case of error.
- HAL UART update
  - Add a new API HAL_UARTEx_GetRxEventType that could be used to retrieve the type of event that has led the RxEventCallback execution.
  - Remove of HAL_LOCK/HAL_UNLOCK calls in HAL UART Tx and Rx APIs.
  - Remove __HAL_LOCK() from HAL_xxx_RegisterCallback()/HAL_xxx_UnRegisterCallback().
  - Disable the Receiver Timeout Interrupt when data reception is completed.
  - Rework of UART_WaitOnFlagUntilTimeout() API to avoid being stuck forever when UART overrun error occurs and to enhance behavior.
  - Update initialisation sequence for TXINV, RXINV and TXRXSWAP settings.
  - Fix incorrect gState check in HAL_UART_RegisterRxEventCallback/HAL_UART_UnRegisterRxEventCallback to allow user Rx Event Callback registration when a transmit is ongoing.
  - Avoid RTOF flag to be cleared by a transmit process in polling mode.
- HAL SMARTCARD update
  - Remove __HAL_LOCK() from HAL_xxx_RegisterCallback()/HAL_xxx_UnRegisterCallback().
- HAL SPI update
  - Fix driver to don’t update state in case of error (HAL_SPI_STATE_READY will be set only in case of HAL_TIMEOUT).
  - Update HAL_SPI_TransmitReceive API to set the bit CRCNEXT in case of one byte transaction.
  - Update IT API to enable interrupts after process unlock.
- HAL IRDA update
  - Remove __HAL_LOCK() from HAL_xxx_RegisterCallback()/HAL_xxx_UnRegisterCallback().
- HAL FDCAN update
  - Refine description of IsFilterMatchingFrame and FilterIndex, members of structure FDCAN_RxHeaderTypeDef.
  - Fix GetIndex issue in HAL_FDCAN_GetRxMessage.
  - Modify misleading DataLength values.
- HAL SAI update
  - Avoid using magic numbers.
  - Fix misalignment between reference manual and HAL SAI driver: remove GCR register.
  - Improve audio quality (avoid potential glitch).
  - Fix incorrect word ‘surcharged’.
- HAL USART update
  - Remove __HAL_LOCK() from HAL_xxx_RegisterCallback()/HAL_xxx_UnRegisterCallback().
- HAL/LL I2C update
  - Move polling code of HAL memory interface through interrupt management to prevent timeout issue using HAL MEM interface through FreeRTOS.
  - Update I2C_IsErrorOccurred to return error if timeout is detected.
  - Clear the ADDRF flag only when direction is confirmed as changed, to prevent that the ADDRF flag is cleared too early when the restart is received.
  - Remove Lock management from callback management functions.
  - Duplicate the test condition after timeout detection to avoid false timeout detection.
  - Update HAL_I2C_IsDeviceReady() API to support 10_bit addressing mode: Update done on the macro I2C_GENERATE_START.
  - Update HAL I2C driver to prefetch data before starting the transmission: implementation of errata sheet workaround I2C2-190208 : Transmission stalled after first byte.
  - Update HAL I2C driver to disable all interrupts after end of transaction.
  - Update HAL_I2C_Init API to clear ADD10 bit in 7 bit addressing mode.
  - Solve Slave No stretch not functional by using HAL Slave interface.
  - Update HAL_I2C_Mem_Write_IT API to initialize XferSize at 0.
  - Update I2C_Slave_ISR_IT, I2C_Slave_ISR_DMA and I2C_ITSlaveCplt to prevent the call of HAL_I2C_ListenCpltCallback twice.
  - Update I2C_WaitOnRXNEFlagUntilTimeout to check I2C_FLAG_AF independently from I2C_FLAG_RXNE.
  - Remove the unusable code in function HAL_I2C_IsDeviceReady.
  - Update I2C_WaitOnFlagUntilTimeout to handle error case.
  - Update HAL_I2C_Slave_Transmit to check if the received NACK is the good one.
  - Update LL_I2C_HandleTranfer function to prevent undefined behavior of volatile usage before updating the CR2 register.
- LL UCPD update
  - Correct register accessed by LL_UCPD_ReadRxPaySize() function.
- HAL USB update
  - Add new function HAL_PCD_EP_Abort() to abort current USB endpoint transfer.
  - PCD: add supporting multi packets transfer on Interrupt endpoint.
  - PCD: software correction added to avoid unexpected STALL condition during EP0 multi packet OUT transfer.
  - Set DCD timeout to a minimum of 300ms before starting BCD primary detection process.
  - hal_pcd.h: add a mask for USB RX bytes count.
- LL UTILS update
  - Align UTILS_PLLVCO_INPUT_MAX value with documentation.
  - Update the number of LATENCY to be coherent with the reference manual.
  - Update package type definitions to be aligned with RM0440.
  - Fix a condition in LL_SetFlashLatency() API to avoid generation of Rule-10.1_R2 warning.
  - Add else statement in the end of LL_SetFlashLatency API to avoid Misra-C 2012 Rule-15.7 warnings.
  - Fix a note about Ticks parameter.

## Development Toolchains and Compilers

- IAR Embedded Workbench for ARM (EWARM) toolchain V8.50.9 + ST-LINKV2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.38 + ST-LINKV2
- STM32CubeIDE toolchain (gcc9_2020_q2_update) V1.14.0

## Supported Devices

- STM32G431/41xx
- STM32G471xx
- STM32G473/83xx
- STM32G474/84xx
- STM32G491/A1xx

V1.2.2 / 10-November-2021

## Main Changes

### Maintenance Release

- General updates to fix known defects and enhancements implementation.

- HAL/LL ADC update
  - Update HAL_ADC_Start_DMA() API to avoid return error when using Independent instance with multimode activated.
  - Update of the TEMPSENSOR_CAL2_TEMP value in the ll_adc.h file.
  - Update LL_ADC_SetChannelSingleDiff() API to be compliant with ARM CLang compiler v6.16.
- HAL/LL RCC update
  - Add missing API IsEnabled for PLL "domain" output.
  - Enhance RCC_MCOx in order to support both MCO number (PA8 and PG10) and AF mapping.
- HAL/LL USART update
  - Handling of UART concurrent register access in case of race condition between Tx and Rx transfers (HAL UART and LL LPUART)
  - Add const qualifier for read only pointers.
  - Improve header description of USART_WaitOnFlagUntilTimeout() function
  - Add a check on the USART parity before enabling the parity error interrupt.
- HAL/LL UART update
  - Fix erroneous UART’s handle state in case of error returned after DMA reception start within UART_Start_Receive_DMA().
  - Correction on UART ReceptionType management in case of ReceptionToIdle API are called from RxEvent callback
  - Handling of UART concurrent register access in case of race condition between Tx and Rx transfers (HAL UART and LL LPUART)
  - Improve header description of UART_WaitOnFlagUntilTimeout() function
  - Add a check on the UART parity before enabling the parity error interruption.
  - Add const qualifier for read only pointers.
  - Fix wrong cast when computing the USARTDIV value in UART_SetConfig().
- LL LPTIM update
  - Add check on PRIMASK register to prevent from enabling unwanted global interrupts within LPTIM_Disable() and LL_LPTIM_Disable().
- LL TIM update
  - Update LL_TIM_OC_SetPulseWidth implementation to properly align the PulseWidth input value with the TIM_ECR register.
  - Fix wrong compile switch used in TIM_LL_EC_DMABURST_BASEADDR constant definitions.
- LL LPUART update
  - Remove useless TXFECF reference from LL LPUART driver.
- HAL IRDA update
  - Improve header description of IRDA_WaitOnFlagUntilTimeout() function
  - Add a check on the IRDA parity before enabling the parity error interrupt.
  - Add const qualifier for read only pointers.
  - Fix wrong cast when computing the USARTDIV value in IRDA_SetConfig().
- HAL SMARTCARD update
  - Improve header description of SMARTCARD_WaitOnFlagUntilTimeout() function.
  - Add const qualifier for read only pointers.
  - Fix wrong cast when computing the USARTDIV value in SMARTCARD_SetConfig().
- HAL/LL SPI update
  - Updated to fix MISRA-C 2012 Rule-13.2.
  - Update LL_SPI_TransmitData8() API to avoid casting the result to 8 bits.
- HAL RTC update
  - Update __HAL_RTC_…(HANDLE, …) macros to access registers through (HANDLE)->Instance pointer and avoid “unused variable” warnings.
- HAL CRYP update
  - CRYP_AESCCM_Process_IT() update to manage header lengths in bytes or words when header length is less than 16 bytes.
- HAL HRTIM update
  - Fix compilation ARMCLANG -Wparenteses-equality warnings.
  - Fix missing initial update when Resynchronized update is used.
- HAL FLASH update
  - Update to support STM32G4 part numbers with 256K flash
  - Disable ICache while Flash programming.
    - Update HAL_FLASHEx_Erase() to remove __HAL_FLASH_INSTRUCTION_CACHE_DISABLE().
- HAL USB update
  - HAL PCD: add fix transfer complete for IN Interrupt transaction in single buffer mode
- HAL GPIO update
  - Reorder EXTI configuration sequence in order to avoid unexpected level detection.
  - Optimize assertion control for GPIO Pull mode in HAL_GPIO_Init() API.
  - Update HAL_GPIO_Init() API to avoid the configuration of PUPDR register when Analog mode is selected.
- HAL EXTI update
  - Update HAL_EXTI_GetConfigLine() API to set default configuration value of Trigger and GPIOSel before checking each corresponding registers.
- HAL USART update
  - Improve header description of USART_WaitOnFlagUntilTimeout() function
  - Add a check on the USART parity before enabling the parity error interrupt.
  - Fix compilation warnings generated with ARMV6 compiler.
- HAL I2C update
  - Update I2C_IsAcknowledgeFailed() API to avoid I2C in busy state if NACK received after transmitting register address.
  - Update to handle errors in polling mode.
    - Rename I2C_IsAcknowledgeFailed() to I2C_IsErrorOccurred() and correctly manage when error occurs.
  - Update to fix issue detected due to low system frequency execution (HSI).
  - Declare an internal macro link to DMA macro to check remaining data: I2C_GET_DMA_REMAIN_DATA.
- HAL SMBUS update
  - Add the support of wake up capability.
    - Add new APIs:
      - HAL_SMBUSEx_EnableWakeUp()
      - HAL_SMBUSEx_DisableWakeUp()
  - Update to fix issue of mismatched data received by master in case of data size to be transmitted by the slave is greater than the data size to be received by the master.
    - Add flush on TX register.
- HAL IWDG update
  - Add LSI startup time in default IWDG timeout calculation (HAL_IWDG_DEFAULT_TIMEOUT).
- HAL RNG update
  - Update timeout mechanism to avoid false timeout detection in case of preemption.
- HAL NAND update
  - Update implementation of “HAL_NAND_Write_Page_16b” and “HAL_NAND_Read_Page_16b” APIs implementation to fix an issue with the page calculation of 8 bits memories.

## Development Toolchains and Compilers

- IAR Embedded Workbench for ARM (EWARM) toolchain V8.50.4 + ST-LINKV2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.31 + ST-LINKV2
- STM32CubeIDE toolchain (gcc9_2020_q2_update) V1.7.0

## Supported Devices

- STM32G431/41xx
- STM32G471xx
- STM32G473/83xx
- STM32G474/84xx
- STM32G491/A1xx

V1.2.1 / 27-January-2021

## Main Changes

### Maintenance Release

- General updates to fix known defects and enhancements implementation

- HAL
- General updates to fix known defects and enhancements implementation.
- Support for new ARM compiler Keil V6.
- Added new defines for ARM compiler V6:
  - __weak
  - __packed
  - __NOINLINE
- LL RCC update
  - Private functions made static.
- HAL CRYP update
  - Correction made for the Official NIST CCM test pattern ciphering failing when header length is null.
  - GCM/GMAC/CCM data header is now fed using DMA instead of polling.
  - Fixed CRYP HAL driver to manage GCM header lengths not multiple of 4 bytes in 8-bit, 16-bit and 32-bit data types.
  - Fixed handling of AUD with size not multiple of 4 bytes in CRYP_AESGCM_Process_IT for GCM.
- HAL RTC Update
  - New APIs to subtract or add one hour to the calendar in one single operation without going through the initialization procedure (Daylight Saving):
    - Add HAL_RTC_DST_Add1Hour()
    - HAL_RTC_DST_Sub1Hour()
    - HAL_RTC_DST_SetStoreOperation()
    - HAL_RTC_DST_ClearStoreOperation()
  - Fixed executing TimeStamp callback when HAL_RTC_SetTimeStamp is called with “Rising Edge” configuration
    - Updated HAL_RTC_SetTimeStamp() API to call __HAL_RTC_TIMESTAMP_EXTI_ENABLE_IT before configuring the TimeStamp.
- HAL/LL TIM update
  - Updated HAL_TIMEx_OnePulseN_Start() and HAL_TIMEx_OnePulseN_Stop() APIs (pooling and IT mode) to take into consideration all OutputChannel parameters.
  - Corrected reversed description of TIM_LL_EC_ONEPULSEMODE One Pulse Mode.
  - Updated LL_TIM_GetCounterMode() API to return the correct counter mode.
- HAL/LL LPTIM update
  - Updated HAL_LPTIM_Init() API implementation to configure digital filter for external clock when LPTIM is configured with internal clock source.
- HAL/LL HRTIM update
  - IRQ handlers optimized by reducing the multiple read-accesses to ISR and IER registers to one read-access per register.
  - LL_HRTIM_FLT_SetSrc() API updated to avoid overwriting the content of FLTINR2 register on successive calls.
- HAL EXTI update
  - __EXTI__LINE is now used instead of LINE which is a standard C macro.
- HAL OPAMP update
  - Corrected OPAMPs outputs for the STM32G4 device table to be coherent with reference manual.
- HAL/LL ADC Update
  - Update HAL_ADC_DeInit() to avoid ADC hardware resource deinitialization when other ADC instances sharing the same common ADC instance are disable.
  - Update temperature sensor stabilization time management.
  - Update timeout mechanism to avoid false timeout detection in case of preemption.
  - Align the defined value of internal regulator stabilization time (LL_ADC_DELAY_INTERNAL_REGUL_STAB_US) with product documentation (20us instead of 10us).
- HAL DAC update
  - Updated HAL_DAC_Stop_DMA() API to not return HAL_ERROR when DAC is already disabled.
  - Updated HAL_DAC_ConfigChannel to return the right timeout error for channel 2.
  - Update HAL_DACEx_DualStart when checking if the software trigger enabled:
    - DAC_TRIGGER_SOFTWARE instead of DAC_CR_TEN1
    - (DAC_TRIGGER_SOFTWARE << (DAC_CHANNEL_2 & 0x10UL)) instead of DAC_CR_TEN2
- HAL NOR Update
  - Corrected how p_endaddress is computed and how p_currentaddress is used in the HAL_NOR_ProgramBuffer() API.
  - NOR command sets can now be selected by manufacturer code, as specified in JEDEC JEP137B 2004-05, using NOR_HandleTypeDef field CommandSet. the following APIs have been updated:
    - HAL_NOR_Init()
    - HAL_NOR_Read_ID()
    - HAL_NOR_ReturnToReadMode()
    - HAL_NOR_Read()
    - HAL_NOR_Program()
    - HAL_NOR_ReadBuffer()
    - HAL_NOR_ProgramBuffer()
    - HAL_NOR_Erase_Block()
    - HAL_NOR_Erase_Chip()
    - HAL_NOR_GetStatus()
  - Added new command operations:
    - NOR_CMD_READ_ARRAY
    - NOR_CMD_WORD_PROGRAM
    - NOR_CMD_BUFFERED_PROGRAM
    - NOR_CMD_CONFIRM
    - NOR_CMD_BLOCK_ERASE
    - NOR_CMD_BLOCK_UNLOCK
    - NOR_CMD_READ_STATUS_REG
    - NOR_CMD_CLEAR_STATUS_REG
  - Updated multiple APIs to treat separately the different memory types.
- LL FMC Update
  - Updated FMC_NORSRAM_Extended_Timing_Init() API to manage the “bus turn around duration” parameter availability.
  - Updated FMC_NORSRAM_Init() API to resolve compilation issue with Microsoft Visual Studio 2017.
- HAL NAND update
  - Updated HAL_NAND_Read_SpareArea_16b() and HAL_NAND_Write_SpareArea_16b() APIs to fix the column address calculation.
- HAL/LL SMARTCARD update
  - Fixed invalid initialization of SMARTCARD configuration by removing the FIFO mode configuration.
  - Fixed typos in SMARTCARD State definition description.
  - Optimized stack usage for multiple APIs.
- HAL/LL IRDA update
  - Fixed typos in IRDA State definition description.
  - Optimized stack usage for multiple APIs.
- HAL/LL UART update
  - Enhanced reception for idle services (ReceptionToIdle):
    - Added a new field (HAL_UART_RxTypeTypeDef) to the UART_HandleTypeDef structure to identify the type of ongoing reception.
    - Added UART Reception Event Callback registration.
  - Added reception specific APIs specific to reception for Idle transfer in different modes:
    - HAL_UARTEx_ReceiveToIdle(): Receive an amount of data in blocking mode until either the expected number of data is received or an IDLE event occurs.
    - HAL_UARTEx_ReceiveToIdle_IT(): Receive an amount of data in interrupt mode until either the expected number of data is received or an IDLE event occurs.
    - HAL_UARTEx_ReceiveToIdle_DMA(): Receive an amount of data in DMA mode until either the expected number of data is received or an IDLE event occurs.
  - Updated HAL_UART_Receive(), HAL_UART_Receive_IT() and HAL_UART_Receive_DMA() APIs to support the new enhancement of ReceptionToIdle.
  - Fixed invalid initialization of UART configuration by removing FIFO mode configuration as it is not member of UART_InitTypeDef Structure.
  - Fixed typos in UART State definition description.
  - Optimized stack usage for multiple APIs.
- HAL/LL USART update
  - Removed IS_USART_OVERSAMPLING() as it is unused.
  - LL_USART_ClockInit now supports clock phase and clock polarity configuration for SPI_Slave mode.
  - Remove useless check on maximum BRR value by removing IS_LL_USART_BRR_MAX() macro.
  - Optimized stack usage for multiple APIs.
  - Removed useless check on maximum BRR value by removing IS_LL_USART_BRR_MAX() macro.
- HAL SMBUS update
  - Support for Fast Mode Plus to be SMBUS rev 3 compliant.
    - Added HAL_SMBUSEx_EnableFastModePlus() and HAL_SMBUSEx_DisableFastModePlus() APIs to manage Fm+.
- LL SPI update
  - Updated to set the FRXTH bit for 8bit data for LL_SPI_Init() API.
- HAL WWDG update
  - Updated HAL driver description.
- HAL/LL USB update
  - Fixed USB ISO IN double buffer mode Transfer.
  - Fixed PMA rx count descriptor

- Added few instructions before reading the RX count register.

## Development Toolchains and Compilers

- IAR Embedded Workbench for ARM (EWARM) toolchain V8.50.4 + ST-LINKV2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.31 + ST-LINKV2
- STM32CubeIDE toolchain V1.6.0

## Supported Devices

- STM32G431/41xx
- STM32G471xx
- STM32G473/83xx
- STM32G474/84xx
- STM32G491/A1xx

V1.2.0 / 26-June-2020

## Main Changes

### Maintenance Release

- Add support for STM32G491xx and STM32G4A1 part numbers

- General updates to fix known defects and enhancements implementation

- HAL/LL GPIO update
  - Enhancement GPIO_TogglePin API to allow the toggling of many pins
  - Update GPIO initialization sequence to avoid unwanted pulse on GPIO Pin’s
- HAL/LL HRTIM update
  - Constants renaming:
    - Rename HAL constants HRTIM_TIMEEVENT_… and HRTIM_TIMEEVENTRESETMODE_… respectively HRTIM_EVENTCOUNTER_… and HRTIM_EVENTCOUNTER_RSTMODE_… to reflect their relation to external event counters.
    - Rename LL constants LL_HRTIM_OUTPUTSET_TIM… and LL_HRTIM_OUTPUTRESET_TIM… to make them compliant to the CMSIS bits definitions they correspond to.
    - Warning: Possible compatibility break with CubeMX 5.6.0 and previous versions!
  - Constants removal:
    - Remove unused HAL constants HRTIM_RSYNCUPDATE_… and HRTIM_TIMEEVENTCOUNTER_….
    - Remove unused LL constant LL_HRTIM_RESETTRIG_OTHER5_CMP4 as the definition it corresponds to (HRTIM_RSTR_TIMFCMP4) exists neither in the CMSIS nor in the reference manual.
- HAL/LL I2S update
  - Update HAL_I2S_DMAStop() API to be more safe
    - Add a check on BSY, TXE and RXNE flags before disabling the I2S
  - Update HAL_I2S_DMAStop() API to fix multi-call transfer issue(to avoid re-initializing the I2S for the next transfer).
    - Add __HAL_I2SEXT_FLUSH_RX_DR() and __HAL_I2S_FLUSH_RX_DR() macros to flush the remaining data inside DR registers.
    - Add new ErrorCode define: HAL_I2S_ERROR_BUSY_LINE_RX
- HAL/LL SPI update
  - Update HAL_SPI_Init() API
    - To avoid setting the BaudRatePrescaler in case of Slave Motorola Mode
    - Use the bit-mask for SPI configuration
  - Update Transmit/Receive processes in half-duplex mode
    - Disable the SPI instance before setting BDIOE bit
  - Update SPI_DMAReceiveCplt() API to handle efficiently the repeated transfers.
    - Disable TX DMA request only in bidirectional receive mode.
  - Fix wrong timeout management
    - Calculate Timeout based on a software loop to avoid blocking issue if Systick is disabled
- HAL SAI update
  - Update HAL_SAI_Init() API to correct the formula in case of SPDIF is wrong
- HAL/LL ADC update
  - Update Channel & external trigger to support STM32G491/STM32G4A1 embedded with 3 ADC:
    - IS_ADC_EXTRIG, IS_ADC_CHANNEL, IS_ADC_EXTRIGINJ, ADC_IS_INDEPENDENT.
    - IS_LL_ADC_REG_TRIG_SOURCE, IS_LL_ADC_INJ_TRIG_SOURCE, __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE.
  - Update note in ll_adc.h & hal_adc.h to highlight that the ADC with transfers DMA and ADC mode auto delay can work simultaneously.
- HAL COMP update
  - Update Blanking sources to support STM32G491/STM32G4A1 embedded with 4 COMP:
    - IS_COMP_BLANKINGSRC_INSTANCE
- HAL OPAMP update
  - Update hal_opamp_ex.c to support STM32G491/STM32G4A1 embedded with 4 OPAMP (OPAMP1/OPAMP2/OPAMP3/OPAMP6):
- HAL FLASH update
  - Update FLASH Latency comment param to list all supported flash latency values.
  - Update FLASH_PAGE_NB to return the right page number(256 pages for devices embedded with 512KB flash size and 64 for devices embedded with 128KB flash size)
- HAL/LL RCC update
  - Update Table 1. HCLK clock frequency for STM32G4xx devices to be aligned with reference manual RM0440
  - Update peripheral clock to support STM32G491/STM32G4A1 devices:
    - HAL_RCCEx_GetPeriphCLKConfig
    - IS_RCC_PERIPHCLOCK
- HAL/LL TIM driver
  - Align HAL/LL TIM driver with latest updates and enhancements
  - Add new macros to enable and disable the fast mode when using the one pulse mode to output a waveform with a minimum delay
    - __HAL_TIM_ENABLE_OCxFAST() and __HAL_TIM_DISABLE_OCxFAST().
  - Update HAL_TIMEx_MasterConfigSynchronization() API to avoid functional errors and assert fails when using some TIM instances as input trigger.
    - Replace IS_TIM_SYNCHRO_INSTANCE() macro by IS_TIM_MASTER_INSTANCE() macro.
    - Add IS_TIM_SLAVE_INSTANCE() macro to check on TIM_SMCR_MSM bit.
  - Remove ‘register’ storage class specifier from LL TIM driver.
  - Add new API HAL_TIM_DMABurst_MultiWriteStart() allowing to configure the DMA Burst to transfer multiple Data from the memory to the TIM peripheral
  - Add new API HAL_TIM_DMABurst_MultiReadStart() allowing to configure the DMA Burst to transfer Data from the TIM peripheral to the memory
- HAL/LL UART driver
  - Update UART polling processes to handle efficiently the Lock mechanism
    - Move the process unlock at the top of the HAL_UART_Receive() and HAL_UART_Transmit() API.
  - Update UART BRR calculation for ROM size gain
  - Remove ‘register’ storage class specifier from LL UART driver.
- HAL/LL USART driver
  - Remove ‘register’ storage class specifier from LL USART driver.
- HAL/LL USB driver
  - Fix USB Bulk transfer double buffer mode
  - Remove register keyword from USB defined macros as no more supported by c++ compiler
  - minor rework USBD_Start and USBD_Stop API, stop device to be handled by HAL_PCD_DeInit()
  - Correct some word spelling issues

## Development Toolchains and Compilers

- IAR Embedded Workbench for ARM (EWARM) toolchain V8.40.1
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.29
- STM32CubeIDE toolchain V1.4.0

## Supported Devices

- STM32G431/41xx
- STM32G471xx
- STM32G473/83xx
- STM32G474/84xx
- STM32G491/A1xx

V1.1.1 / 14-February-2020

## Main Changes

### Maintenance Release

- General updates to fix known defects and enhancements implementation

- HAL/LL CRYP update
  - Correct MISRA C:2012 warnings reported by rules 2.2_c, 10.1_R6, 10.3, 10.4_a, 10.6, 12.1, 13.5 15.7
  - Perform a new check mechanism on the cryp buffer size in Encryption et Decryption API
    - Add IS_CRYP_BUFFERSIZE() macro
  - Clean up the HAL_CRYP_Resume() API to avoid infinite loop due to an early interruption during resumption process
    - Remove __HAL_CRYP_ENABLE_IT() and __HAL_CRYP_ENABLE() API .
  - Add new parameter in the CRYP_HandleTypeDef structure
    - Add SizesSum_saved to save the SizesSum when processing is suspended
    - Update the HAL_CRYP_Suspend() and HAL_CRYP_Resume() API by adding this new parameter
  - Add missing interruptions re-enabling operations following an all flags clear-up in the CRYP_PhaseProcessingResume() API
  - Support AAD with all possible byte sizes, not only multiple of 4 bytes
    - Update CRYP_GCMCCM_SetHeaderPhase() API
    - Add new parameter HeaderWidthUnit in the CRYP_ConfigTypeDef structure which contains the Cryp Header Width Unit
    - Add new definition of the CRYP Header size Unit
      - CRYP_HEADERWIDTHUNIT_WORD
      - CRYP_HEADERWIDTHUNIT_BYTE
  - Support data encryption and decryption with length not only multiple of 16 bytes
    - Update IS_CRYP_BUFFERSIZE() macro
    - Update AES functions : CRYP_AES_ProcessData() / CRYP_AES_IT() / CRYP_AESCCM_Process() / CRYP_AESGCM_Process_DMA()
    - Update CRYP_GCMCCM_SetPayloadPhase_IT() API
- HAL/LL FMAC update
  - General updates to comply to internal coding rules.
- HAL GPIO update
  - Update the GPIO initialization sequence in HAL_GPIO_Init() API to avoid unwanted glitches on GPIO pins.
  - Add missing GPIO Alternate Function definitions:
    - GPIO_AF2_TIM16, GPIO_AF9_TIM8, GPIO_AF11_TIM8, GPIO_AF12_TIM1.
- HAL HRTIM update
  - Update HAL_HRTIM_WaveformCompareConfig() to clear HRTIM_TIMxCR.DELCMP bitfield when the auto-delayed protection mode is disabled.
  - Correct some “HRTIM_OUTPUTSET_TIMxx” constant names which are not compliant with Timer Events Mapping specified in the reference manual
    - Remove HRTIM_OUTPUTSET_TIMCEV1_TIMACMP1, HRTIM_OUTPUTSET_TIMEEV5_TIMDCMP2 , HRTIM_OUTPUTRESET_TIMCEV1_TIMACMP1 and HRTIM_OUTPUTRESET_TIMEEV5_TIMDCMP2
    - Add HRTIM_OUTPUTSET_TIMEEV5_TIMCCMP2 and HRTIM_OUTPUTSET_TIMCEV2_TIMACMP3 , HRTIM_OUTPUTRESET_TIMCEV2_TIMACMP3 and HRTIM_OUTPUTRESET_TIMEEV5_TIMCCMP2
    - Update HRTIM_OUTPUTSET_TIMCEV2_TIMACMP2 and HRTIM_OUTPUTRESET_TIMCEV2_TIMACMP2 definitions
  - Update HAL_HRTIM_DLLCalibrationStart() and HAL_HRTIM_DLLCalibrationStart_IT() API by setting HRTIM state ready to avoid some unstable behavior of the TIMER E.
  - Add new check field in the IS_HRTIM_EVENTSRC() macro to check also on EVENT
  - Add a new check in the HAL_HRTIM_EventConfig() API on event and event source through the IS_HRTIM_EVENTSRC() macro
  - Remove UPDGAT bits reset from the HRTIM_TimingUnitWaveform_Control() API
  - Add a lock and unlock handle process in the HAL_HRTIM_SimpleOCChannelConfig() API
- HAL I2C update
  - Update I2C_DMAAbort() APIs to fix hardfault issue when hdmatx and hdmarx parameters in i2c handle aren’t initialized (NULL pointer).
    - Add additional check on hi2c->hdmtx and hi2c->hdmarx before resetting DMA Tx/Rx complete callbacks
  - Fix HAL I2C slave interrupt handling issue with I2C sequential transfers.
    - Update I2C_Slave_ISR_IT() and I2C_Slave_ISR_DMA() APIs to check on STOP condition and handle it before clearing the ADDR flag
- HAL LPTIM update
  - Add a polling mechanism to check on LPTIM_FLAG_XXOK flags in different API
    - Add LPTIM_WaitForFlag() API to wait for flag set.
    - Perform new checks on HAL_LPTIM_STATE_TIMEOUT.
  - Apply digital filter for external clock for all LPTIM clock source.
    - Update HAL_LPTIM_Init() API
  - Correct the input1source and input2source selection
    - Update LL_LPTIM_SetInput1Src and LL_LPTIM_SetInput2Src
      - Remove WRITE_REG and replace it by MODIFY_REG
- HAL/LL RTC update
  - Update API HAL_RTC_SetAlarm_IT() to allow changing alarm time “on the fly” simply by calling the API again.
  - Update API LL_RTC_BKP_SetRegister() and API LL_RTC_BKP_GetRegister() to comply to rules 2.2 and 13.2 of MISRAC-2012.
- HAL SPI update
  - Update the “Rx DMA transfer complete callback” to disable the Tx DMA request only in case of full-duplex mode and not it in half-duplex mode.
- HAL TIM update
  - Update Encoder interface mode to keep TIM_CCER_CCxNP bits low
    - Add TIM_ENCODERINPUTPOLARITY_RISING and TIM_ENCODERINPUTPOLARITY_FALLING definitions to determine encoder input polarity.
    - Add IS_TIM_ENCODERINPUT_POLARITY() macro to check the encoder input polarity.
    - Update HAL_TIM_Encoder_Init() API
      - Replace IS_TIM_IC_POLARITY() macro by IS_TIM_ENCODERINPUT_POLARITY() macro.
  - Provide new API to set and clear UIFREMAP
    - Add new definition for TIM Update Interrupt Flag Remap
      - TIM_UIFREMAP_DISABLE
      - TIM_UIFREMAP_ENABLE
    - Add new macro in HAL driver to enable and desable the Update Interrupt Flag Remap
      - __HAL_TIM_UIFREMAP_ENABLE()
      - __HAL_TIM_UIFREMAP_DISABLE()/__HAL_TIM_GET_UIFCPY macro
    - Add new mechanism to check whether the update interrupt flag (UIF) copy is set or not
      - Add the __HAL_TIM_GET_UIFCPY() macro in the HAL driver
      - Add LL_TIM_IsActiveUIFCPY() API in the LL driver
    - Add new macro to check on the Update Interrupt Flag Remap mode
      - IS_TIM_UIFREMAP_MODE()
  - Remove useless TIM trigger selector
  - Fix bug when using multiple DMA request to different channels of same timer
    - Introduce DMA burst state management mechanism
      - Add a new structure for DMA Burst States definition : HAL_TIM_DMABurstStateTypeDef
      - Update __HAL_TIM_RESET_HANDLE_STATE to support DMABurstState
      - Add a new API HAL_TIM_DMABurstState() to get the actual state of a DMA burst operation
      - Add DMABurstState, the DMA burst operation state, in the TIM_HandleTypeDef structure
      - Add new API TIM_DMAErrorCCxN() for TIM DMA error callback (complementary channel)
      - Add new API TIM_DMADelayPulseNCplt() for TIM DMA Delay Pulse complete callback (complementary channel)
  - Implement TIM channel state management mechanism
    - Add new macro
      - TIM_CHANNEL_STATE_SET_ALL and TIM_CHANNEL_N_STATE_SET_ALL
      - TIM_CHANNEL_STATE_SET and TIM_CHANNEL_N_STATE_SET
      - TIM_CHANNEL_STATE_GET and TIM_CHANNEL_N_STATE_GET
    - Add new API HAL_TIM_GetActiveChannel()
    - Add new API HAL_TIM_GetChannelState() to get actual state of the TIM channel
    - Add a new structure for TIM channel States definition : HAL_TIM_ChannelStateTypeDef
    - Update __HAL_TIM_RESET_HANDLE_STATE to support ChannelState and ChannelNState
    - Add a new element in the TIM_HandleTypeDef structure : ChannelState to manage TIM channel operation stat.
    - Add a new element in the TIM_HandleTypeDef structure : ChannelNState to manage TIM complementary channel operation state
- HAL/LL USART update
  - Add support to the Receiver Timeout Interrupt in the HAL_USART_IRQHandler
  - Fix wrong value for SlaveMode field in USART handle after HAL_USARTEx_DisableSlaveMode() call
    - Set USART_SLAVEMODE_DISABLE instead of USART_SLAVEMODE_ENABLE
- HAL USB update
  - Improve USB endpoint out re-enabling with double-buffer mode.
- LL UTILS update
  - API UTILS_SetFlashLatency() renamed LL_SetFlashLatency() and set exportable.
  - API LL_PLL_ConfigSystemClock_HSI() and API LL_PLL_ConfigSystemClock_HSE() updated to set back the AHB prescaler to 1 after it has been temporarily set to 2 to avoid undershoot when configuring PLL at high frequencies.

## Development Toolchains and Compilers

- IAR Embedded Workbench for ARM (EWARM) toolchain V8.32.3
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.27.1
- STM32CubeIDE toolchain v1.3.0

## Supported Devices

- STM32G431/41xx
- STM32G471xx
- STM32G473/83xx
- STM32G474/84xx

V1.1.0 / 28-June-2019

## Main Changes

### Maintenance Release

Maintenance release of HAL (Hardware Abstraction Layer) and LL (Low layers) drivers to support STM32G431/41xx, STM32G471xx, STM32G473/83xx and STM32G474/84xx.

## Contents

Additional features and changes :
Headline
General: Support of device STM32G483xx in HAL and LL drivers
COMP: Suppress Deglitcher mode - Not supported on STM32G4 series
HAL: Change naming of the IRQn 2 to RTC_TAMP_LSECSS_IRQn
HRTIM: HRTIM_OUTPUTRESET_TIMAEVx renamed to HRTIM_OUTPUTRESET_TIMEVx
TIM: Add new macro to configure fast mode
TIM: Master Slave Mode (MSM) is now configurable

Bugs fix :
Headline
General : redefinition of registers with adjusted address MUST be volatile
DMA : DMA2 instance cannot be configured in LL drivers
GPIO: HAL_GPIO_DeInit() bug on EXTI management
GPIO: Compilation warning with IAR v8.30
HAL: Correct potential issue within HAL_SetTickFreq() function
HRTIM: HRTIM_TIMxCR.DELCMP isn’t systematically programmed
HRTIM: Fault source programming isn’t wrong in HAL_HRTIM_FaultConfig
HRTIM : Useless Assignment at function HAL_HRTIM_SimpleOCChannelConfig
RCC: Should not overwrite Tick priority
RTC: HAL_RTCEx_SetWakeUpTimer WUTWF management reworked to be aligned with Reference Manual
RTC: INITF can rise too early when entering init mode just after exiting
RTC : fix issue in define with STM32L4 LL RTC month macros
RTC : Remove ALRBWF and ALRAWF bits
TIM: CodeSonar warnings about useless assignment in HAL_TIMEx_ConfigBreakInput()

## Development Toolchains and Compilers

- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2

## Supported Devices

- STM32G431/41xx
- STM32G471xx
- STM32G473/83xx
- STM32G474/84xx

V1.0.0 / 12-April-2019

## Main Changes

### First release

First official release of HAL (Hardware Abstraction Layer) and LL (Low layers) drivers to support STM32G431/41xx, STM32G471xx, STM32G473/83xx and STM32G474/84xx.

## Development Toolchains and Compilers

- IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2
- RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25
- System Workbench STM32 (SW4STM32) toolchain V2.7.2

## Supported Devices

- STM32G431/41xx
- STM32G471xx
- STM32G473xx
- STM32G474/84xx