diff --git a/system/Drivers/STM32L1xx_HAL_Driver/README.md b/system/Drivers/STM32L1xx_HAL_Driver/README.md index d25467c146..74906abb46 100644 --- a/system/Drivers/STM32L1xx_HAL_Driver/README.md +++ b/system/Drivers/STM32L1xx_HAL_Driver/README.md @@ -40,6 +40,7 @@ HAL Driver L1 | CMSIS Device L1 | CMSIS Core | Was delivered in the full MCU pac ------------- | --------------- | ---------- | ------------------------------------- Tag v1.4.0 | Tag v2.3.0 | Tag v5.4.0_cm3 | Tag v1.9.0 (and following, if any, till next new tag) Tag v1.4.1 | Tag v2.3.1 | Tag v5.4.0_cm3 | Tag v1.10.0 (and following, if any, till next new tag) +Tag v1.4.2 | Tag v2.3.1 | Tag v5.4.0_cm3 | Tag v1.10.1 (and following, if any, till next new tag) The full **STM32CubeL1** MCU package is available [here](https://github.com/STMicroelectronics/STM32CubeL1). diff --git a/system/Drivers/STM32L1xx_HAL_Driver/Release_Notes.html b/system/Drivers/STM32L1xx_HAL_Driver/Release_Notes.html index af2d8ba848..b88bc19aa3 100644 --- a/system/Drivers/STM32L1xx_HAL_Driver/Release_Notes.html +++ b/system/Drivers/STM32L1xx_HAL_Driver/Release_Notes.html @@ -46,15 +46,35 @@

Purpose

Update History

- +

Main Changes

Maintenance release

    +
  • Patch release to fix issue in I2C HAL driver
  • +
+

Contents

+
    +
  • HAL I2C driver +
      +
    • Update I2C_MasterReceiveRXNE() static API to avoid set the STOP bit again after the bit clearing by Hardware during the masking operation. +
        +
      • Add new API I2C_WaitOnSTOPRequestThroughIT() to wait for stop bit.
      • +
    • +
  • +
+
+
+
+ +
+

Main Changes

+

Maintenance release

+
  • Add new HAL EXTI driver
  • General updates to fix known defects and enhancements implementation
-

Contents

+

Contents

  • HAL driver
      @@ -247,14 +267,14 @@

      Contents

      -

      Main Changes

      -

      Maintenance release

      +

      Main Changes

      +

      Maintenance release

      • Add support of HAL callback registration feature
      • Add several enhancements implementation
      • Fix known defects to be aligned with others STM32 series
      -

      Contents

      +

      Contents

      • HAL/LL generic
          @@ -530,9 +550,9 @@

          Contents

          -

          Main Changes

          +

          Main Changes

          Patch release

          -

          Contents

          +

          Contents

          • HAL/LL generic
              @@ -545,9 +565,9 @@

              Contents

              -

              Main Changes

              -

              Maintenance release

              -

              Contents

              +

              Main Changes

              +

              Maintenance release

              +

              Contents

              • HAL/LL generic
                  @@ -618,8 +638,8 @@

                  Contents

                  -

                  Main Changes

                  -

                  Maintenance release

                  +

                  Main Changes

                  +

                  Maintenance release

                  • First official release supporting the Low Level drivers for the STM32L1xx family:
                      @@ -628,7 +648,7 @@

                      Maintenance release

                    • Low Layer drivers APIs are implemented as static inline function in new Inc/stm32l1xx_ll_ppp.h files for PPP peripherals, there is no configuration file and each stm32l1xx_ll_ppp.h file must be included in user code.
                  -

                  Contents

                  +

                  Contents

                  • Generic updates
                      @@ -723,9 +743,9 @@

                      Contents

                      -

                      Main Changes

                      -

                      Maintenance release

                      -

                      Contents

                      +

                      Main Changes

                      +

                      Maintenance release

                      +

                      Contents

                      • Generic update
                          @@ -774,9 +794,9 @@

                          Contents

                          -

                          Main Changes

                          -

                          Maintenance release

                          -

                          Contents

                          +

                          Main Changes

                          +

                          Maintenance release

                          +

                          Contents

                          • ADC
                              @@ -860,13 +880,13 @@

                              Contents

                              -

                              Main Changes

                              -

                              Maintenance release

                              +

                              Main Changes

                              +

                              Maintenance release

                              • Include path changes for compilation under Unix environment
                              • Update drivers to be C++ compliant
                              -

                              Contents

                              +

                              Contents

                              • CORTEX
                                  @@ -932,12 +952,12 @@

                                  Contents

                                  -

                                  Main Changes

                                  -

                                  Maintenance release

                                  +

                                  Main Changes

                                  +

                                  Maintenance release

                                  • Add support of new STM32L1 eXtended devices - STM32l151xDX, STM32l152xDX & STM32l62xDX
                                  -

                                  Contents

                                  +

                                  Contents

                                  • HAL generic
                                      @@ -959,7 +979,7 @@

                                      Contents

                                      -

                                      Main Changes

                                      +

                                      Main Changes

                                      First official release

                                      diff --git a/system/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal.c b/system/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal.c index 576e967230..abef0ab085 100644 --- a/system/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal.c +++ b/system/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal.c @@ -54,11 +54,11 @@ */ /** - * @brief STM32L1xx HAL Driver version number V1.4.1 + * @brief STM32L1xx HAL Driver version number V1.4.2 */ #define __STM32L1xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */ #define __STM32L1xx_HAL_VERSION_SUB1 (0x04) /*!< [23:16] sub1 version */ -#define __STM32L1xx_HAL_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */ +#define __STM32L1xx_HAL_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ #define __STM32L1xx_HAL_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32L1xx_HAL_VERSION ((__STM32L1xx_HAL_VERSION_MAIN << 24)\ |(__STM32L1xx_HAL_VERSION_SUB1 << 16)\ diff --git a/system/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_i2c.c b/system/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_i2c.c index 0e115df143..e2c07962d7 100644 --- a/system/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_i2c.c +++ b/system/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal_i2c.c @@ -319,6 +319,7 @@ */ #define I2C_TIMEOUT_FLAG 35U /*!< Timeout 35 ms */ #define I2C_TIMEOUT_BUSY_FLAG 25U /*!< Timeout 25 ms */ +#define I2C_TIMEOUT_STOP_FLAG 5U /*!< Timeout 5 ms */ #define I2C_NO_OPTION_FRAME 0xFFFF0000U /*!< XferOptions default value */ /* Private define for @ref PreviousState usage */ @@ -359,6 +360,7 @@ static HAL_StatusTypeDef I2C_WaitOnTXEFlagUntilTimeout(I2C_HandleTypeDef *hi2c, static HAL_StatusTypeDef I2C_WaitOnBTFFlagUntilTimeout(I2C_HandleTypeDef *hi2c, uint32_t Timeout, uint32_t Tickstart); static HAL_StatusTypeDef I2C_WaitOnRXNEFlagUntilTimeout(I2C_HandleTypeDef *hi2c, uint32_t Timeout, uint32_t Tickstart); static HAL_StatusTypeDef I2C_WaitOnSTOPFlagUntilTimeout(I2C_HandleTypeDef *hi2c, uint32_t Timeout, uint32_t Tickstart); +static HAL_StatusTypeDef I2C_WaitOnSTOPRequestThroughIT(I2C_HandleTypeDef *hi2c); static HAL_StatusTypeDef I2C_IsAcknowledgeFailed(I2C_HandleTypeDef *hi2c); /* Private functions for I2C transfer IRQ handler */ @@ -5341,43 +5343,70 @@ static void I2C_MasterReceive_RXNE(I2C_HandleTypeDef *hi2c) } else if ((hi2c->XferOptions != I2C_FIRST_AND_NEXT_FRAME) && ((tmp == 1U) || (tmp == 0U))) { - /* Disable Acknowledge */ - CLEAR_BIT(hi2c->Instance->CR1, I2C_CR1_ACK); + if (I2C_WaitOnSTOPRequestThroughIT(hi2c) == HAL_OK) + { + /* Disable Acknowledge */ + CLEAR_BIT(hi2c->Instance->CR1, I2C_CR1_ACK); - /* Disable EVT, BUF and ERR interrupt */ - __HAL_I2C_DISABLE_IT(hi2c, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR); + /* Disable EVT, BUF and ERR interrupt */ + __HAL_I2C_DISABLE_IT(hi2c, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR); - /* Read data from DR */ - *hi2c->pBuffPtr = (uint8_t)hi2c->Instance->DR; + /* Read data from DR */ + *hi2c->pBuffPtr = (uint8_t)hi2c->Instance->DR; - /* Increment Buffer pointer */ - hi2c->pBuffPtr++; + /* Increment Buffer pointer */ + hi2c->pBuffPtr++; - /* Update counter */ - hi2c->XferCount--; + /* Update counter */ + hi2c->XferCount--; - hi2c->State = HAL_I2C_STATE_READY; + hi2c->State = HAL_I2C_STATE_READY; - if (hi2c->Mode == HAL_I2C_MODE_MEM) - { - hi2c->Mode = HAL_I2C_MODE_NONE; - hi2c->PreviousState = I2C_STATE_NONE; + if (hi2c->Mode == HAL_I2C_MODE_MEM) + { + hi2c->Mode = HAL_I2C_MODE_NONE; + hi2c->PreviousState = I2C_STATE_NONE; #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1) - hi2c->MemRxCpltCallback(hi2c); + hi2c->MemRxCpltCallback(hi2c); #else - HAL_I2C_MemRxCpltCallback(hi2c); + HAL_I2C_MemRxCpltCallback(hi2c); #endif /* USE_HAL_I2C_REGISTER_CALLBACKS */ + } + else + { + hi2c->Mode = HAL_I2C_MODE_NONE; + hi2c->PreviousState = I2C_STATE_MASTER_BUSY_RX; + +#if (USE_HAL_I2C_REGISTER_CALLBACKS == 1) + hi2c->MasterRxCpltCallback(hi2c); +#else + HAL_I2C_MasterRxCpltCallback(hi2c); +#endif /* USE_HAL_I2C_REGISTER_CALLBACKS */ + } } else { + /* Disable EVT, BUF and ERR interrupt */ + __HAL_I2C_DISABLE_IT(hi2c, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR); + + /* Read data from DR */ + *hi2c->pBuffPtr = (uint8_t)hi2c->Instance->DR; + + /* Increment Buffer pointer */ + hi2c->pBuffPtr++; + + /* Update counter */ + hi2c->XferCount--; + + hi2c->State = HAL_I2C_STATE_READY; hi2c->Mode = HAL_I2C_MODE_NONE; - hi2c->PreviousState = I2C_STATE_MASTER_BUSY_RX; + /* Call user error callback */ #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1) - hi2c->MasterRxCpltCallback(hi2c); + hi2c->ErrorCallback(hi2c); #else - HAL_I2C_MasterRxCpltCallback(hi2c); + HAL_I2C_ErrorCallback(hi2c); #endif /* USE_HAL_I2C_REGISTER_CALLBACKS */ } } @@ -7147,6 +7176,33 @@ static HAL_StatusTypeDef I2C_WaitOnSTOPFlagUntilTimeout(I2C_HandleTypeDef *hi2c, return HAL_OK; } +/** + * @brief This function handles I2C Communication Timeout for specific usage of STOP request through Interrupt. + * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains + * the configuration information for the specified I2C. + * @retval HAL status + */ +static HAL_StatusTypeDef I2C_WaitOnSTOPRequestThroughIT(I2C_HandleTypeDef *hi2c) +{ + __IO uint32_t count = 0U; + + /* Wait until STOP flag is reset */ + count = I2C_TIMEOUT_STOP_FLAG * (SystemCoreClock / 25U / 1000U); + do + { + count--; + if (count == 0U) + { + hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT; + + return HAL_ERROR; + } + } + while (READ_BIT(hi2c->Instance->CR1, I2C_CR1_STOP) == I2C_CR1_STOP); + + return HAL_OK; +} + /** * @brief This function handles I2C Communication Timeout for specific usage of RXNE flag. * @param hi2c Pointer to a I2C_HandleTypeDef structure that contains diff --git a/system/Drivers/STM32YYxx_HAL_Driver_version.md b/system/Drivers/STM32YYxx_HAL_Driver_version.md index 7ca5913ee7..9c6104820b 100644 --- a/system/Drivers/STM32YYxx_HAL_Driver_version.md +++ b/system/Drivers/STM32YYxx_HAL_Driver_version.md @@ -10,7 +10,7 @@ * STM32G4: 1.2.0 * STM32H7: 1.9.0 * STM32L0: 1.10.3 - * STM32L1: 1.4.1 + * STM32L1: 1.4.2 * STM32L4: 1.12.0 * STM32MP1: 1.2.0 * STM32WB: 1.6.0