cancel
Showing results for 
Search instead for 
Did you mean: 

Is stm32f4xx_gpio.c broken - missing BSRR register?

darek
Associate
Posted on March 26, 2015 at 15:48

Dear All,

I am new to an  embedded world in general and to the STM32F4xx controllers in particular.  In order to learn the  trade, I got the STM32429I-Discovery board and along with the hardware, I have installed:

  •   

    emIDE development environment version 2.20

  • STM32F4xx DSP and Peripherals Library ver. 1.5.0 ( 06 March�15)

  • STM32Cube version 1.5.0

  • And other tools for flashing/monitoring  the board

I found an example in (which is not exactly for the Discovery board) :

\STM32F4xx_DSP_StdPeriph_Lib\Project\STM32F4xx_StdPeriph_Examples\GPIO\GPIO_IOToggle

added all (I hope) required  *.h , and *c files, and tried to build the binary.

The compiler failed to  produce a valid output,  and instead I got the following error message:

C:\Users\Work\STM32F4xx_DSP_StdPeriph_Lib\Libraries\STM32F4xx_StdPeriph_Driver\src\stm32f4xx_gpio.c: In function 'GPIO_SetBits':

C:\Users\Work\STM32F4xx_DSP_StdPeriph_Lib\Libraries\STM32F4xx_StdPeriph_Driver\src\stm32f4xx_gpio.c:418:8: error: 'GPIO_TypeDef' has no member named 'BSRRL'

The gcc compiler includes the  file stm32f429xx.h where the �GIO_TypeDef� is defined.

It seems that the stm32f4xx_gpio.c is broken because the whole file uses the old  register definition.

Extra compiler &sharpdefines:

  •   DEBUG=1

  •   USE_STDPERIPH_DRIVER

  •   USE_STM32F429_439xx

  •   STM32F429xx

 How to fix this issue ? Or maybe I did miss something ?

 Your help is highly appreciated.

Cheers,

  Darek

#stm32f4xx_gpio
1 REPLY 1
Posted on March 26, 2015 at 16:46

You seem to be mixing and matching incompatible library versions and include files.

STM32F4xx_DSP_StdPeriph_Lib_V1.4.0\Libraries\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h

...
 /**
* @brief General Purpose I/O
*/
typedef struct
{
__IO uint32_t MODER; /*!< GPIO port mode register, Address offset: 0x00 */
__IO uint32_t OTYPER; /*!< GPIO port output type register, Address offset: 0x04 */
__IO uint32_t OSPEEDR; /*!< GPIO port output speed register, Address offset: 0x08 */
__IO uint32_t PUPDR; /*!< GPIO port pull-up/pull-down register, Address offset: 0x0C */
__IO uint32_t IDR; /*!< GPIO port input data register, Address offset: 0x10 */
__IO uint32_t ODR; /*!< GPIO port output data register, Address offset: 0x14 */
__IO uint16_t BSRRL; /*!< GPIO port bit set/reset low register, Address offset: 0x18 */
__IO uint16_t BSRRH; /*!< GPIO port bit set/reset high register, Address offset: 0x1A */
__IO uint32_t LCKR; /*!< GPIO port configuration lock register, Address offset: 0x1C */
__IO uint32_t AFR[2]; /*!< GPIO alternate function registers, Address offset: 0x20-0x24 */
} GPIO_TypeDef;
 ... 

You need to use a coherent pairing of library code, and make sure that the include paths configured into the project/compiler pull the right files from the correct directories.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..