cancel
Showing results for 
Search instead for 
Did you mean: 

Bug: HAL_GPIO_Init -> GPIO_MODE_AF and EXTI_MODE

michaelisaev9
Associate II
Posted on July 28, 2015 at 13:52

Combination of GPIO_MODE_AF and EXTI_MODE is non-working.

In my case that was NSS pin in SPI Slave Mode.

HAL code (stm32fxxx_hal_gpio):

      /*--------------------- GPIO Mode Configuration ------------------------*/

 

      /* In case of Alternate function mode selection */

 

      if((GPIO_Init->Mode == GPIO_MODE_AF_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_OD))

 

and

      /* In case of Output or Alternate function mode selection */

 

      if((GPIO_Init->Mode == GPIO_MODE_OUTPUT_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_PP) ||

 

         (GPIO_Init->Mode == GPIO_MODE_OUTPUT_OD) || (GPIO_Init->Mode == GPIO_MODE_AF_OD))

 

      {

Solution:

Change code by applying mask:

      /*--------------------- GPIO Mode Configuration ------------------------*/

 

      /* In case of Alternate function mode selection */

 

      if((GPIO_Init->Mode & GPIO_MODE) == GPIO_MODE_AF_PP)

 

      {

 

 

and

 

 

      /* In case of Output or Alternate function mode selection */

 

      if ((GPIO_Init->Mode & GPIO_MODE) != GPIO_MODE_INPUT)

 

      {

3 REPLIES 3
Posted on August 03, 2015 at 12:10

Hi isaev.michael,

What do you mean by ''Combination of GPIO_MODE_AF and EXTI_MODE is non-working''? and which product are using?

-Shahrzed-

michaelisaev9
Associate II
Posted on February 08, 2016 at 05:27

Hi, shahrzad !

In one of my projects I need to do some work on SPI Slave with hardware NSS when it come inactive (end of session). In my first post I meant that when I combine GPIO_MODE_AF_xx (SPI Slave NSS in input mode) and GPIO_MODE_IT_xx, alternative function will not be activated, as code of HAL_GPIO_Init() checks for equality with GPIO_MODE_AF_PP and GPIO_MODE_AF_OD without masking interrupt mode bits. Processos doesn't prohibit such combinations, and all works fine after some correction of HAL_GPIO_Init() code.

Walid FTITI_O
Senior II
Posted on March 01, 2016 at 14:45

Hi isaev.michael,

Thanks for your feedbacks and contribution. I will check this with our developpement team and come back to you.

-Hannibal-