Skip to main content
bas
Associate
January 20, 2016
Question

STM32Cube_FW_L4 V1.2.0 bug ?

  • January 20, 2016
  • 2 replies
  • 673 views
Posted on January 20, 2016 at 21:52

While trying to use GPIO inputs as inputs for the ADC, I discovered that the ADC control mode was not programmed correctly in the function HAL_GPIO_Init.

I replaced:

        temp &= ~(GPIO_ASCR_ASC0 << position) ;

        temp |= (((GPIO_Init->Mode & ANALOG_MODE) >> 3) << position);

with

        temp |= GPIO_ASCR_ASC0 << position;

and got it working properly.

If you agree, I suggest you correct this in a future release.

#adc-stm32l4
This topic has been closed for replies.

2 replies

Nesrine M_O
Associate
January 21, 2016
Posted on January 21, 2016 at 13:43

Hi verhelst.bas,

I think that your problem is not really related to a bug in the HAL_GPIO_Init function but it’s in the way that you initialize your GPIO mode structure.

 I guess that you program your structure as below 

 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG ;

 But it has to be: 

 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG_ADC_CONTROL;

-Syrine-

bas
basAuthor
Associate
January 26, 2016
Posted on January 26, 2016 at 18:37

Syrine, You're right. I how have successfully ported the Motor Control software from F4xx to L476 and IHM07M1 board.

From: Syrine

Posted: Thursday, January 21, 2016 1:44 PM

Subject: STM32Cube_FW_L4 V1.2.0 bug ?

Hi verhelst.bas,

I think that your problem is not really related to a bug in the HAL_GPIO_Init function but it’s in the way that you initialize your GPIO mode structure.

 I guess that you program your structure as below 

 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG ;

 But it has to be: 

 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG_ADC_CONTROL;

-Syrine-