cancel
Showing results for 
Search instead for 
Did you mean: 

Bug Report STM32Cube_FW_F4_V1.21.0 - Bug fix in macro __HAL_RCC_GET_I2S_SOURCE()

Mete C.
Associate II
Posted on June 23, 2018 at 06:45

The macro definition in the library file

STM32Cube_FW_F4_V1.0/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h at line 6112has the original definition below:

/** @brief Macro to get the I2S clock source (I2SCLK).
 * @retval The clock source can be one of the following values:
 * @arg @ref RCC_I2SCLKSOURCE_PLLI2S: PLLI2S clock used as I2S clock source.
 * @arg @ref RCC_I2SCLKSOURCE_EXT External clock mapped on the I2S_CKIN pin
 * used as I2S clock source
 */
#define __HAL_RCC_GET_I2S_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_I2SSRC)))�?�?�?�?�?�?�?�?

The problem with this macro is that it does never returns neither of the following values:

RCC_I2SCLKSOURCE_PLLI2S

RCC_I2SCLKSOURCE_EXT

This is simply because of the missing shift operation in the macro. The correct form of the macro should be like the following:

#define __HAL_RCC_GET_I2S_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_I2SSRC)) >> RCC_CFGR_I2SSRC_Pos)�?

#stm32 #stm32cube_fw_f4_v1.0 #stm32cube
1 REPLY 1

@CubeMX Please create an account for someone responsible for managing or collating issues with the software.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..