Question
bug in generated code in stm32h5xx_hal_msp.c for ADC3
Hello,
maybe someone can check this,it seems to be incorrectly generated code.
In my application for STM32H5xx I want to use ADC3.
void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
if(hadc->Instance==ADC3)
{
...
.../* Peripheral clock enable */
__HAL_RCC_ADC_CLK_ENABLE();
This macro does not enable ADC3.
#define __HAL_RCC_ADC_CLK_ENABLE() do { \
__IO uint32_t tmpreg; \
SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN); \
/* Delay after an RCC peripheral clock enabling */ \
tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADCEN); \
UNUSED(tmpreg); \
} while(0)
I think something like this is required:
#define __HAL_RCC_ADC3_CLK_ENABLE() do { \
__IO uint32_t tmpreg; \
SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADC3EN); \
/* Delay after an RCC peripheral clock enabling */ \
tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_ADC3EN); \
UNUSED(tmpreg); \
} while(0)
