cancel
Showing results for 
Search instead for 
Did you mean: 

BSRR - F4 vs F3

ee06091
Associate III
Posted on September 06, 2013 at 00:09

Hi,

I'm porting a code from F4 to F3 and one of the erros I'm getting is:

stm32f_stpdrv.c: In function 'TIM3_IRQHandler':
stm32f_stpdrv.c:192:20: error: 'GPIO_TypeDef' has no member named 'BSRRH'
stm32f_stpdrv.c:197:20: error: 'GPIO_TypeDef' has no member named 'BSRRL'
stm32f_stpdrv.c:213:20: error: 'GPIO_TypeDef' has no member named 'BSRRH'
stm32f_stpdrv.c:215:20: error: 'GPIO_TypeDef' has no member named 'BSRRL'
stm32f_stpdrv.c: In function '__MotorSetDir':
stm32f_stpdrv.c:346:19: error: 'GPIO_TypeDef' has no member named 'BSRRH'
stm32f_stpdrv.c:348:19: error: 'GPIO_TypeDef' has no member named 'BSRRH'
stm32f_stpdrv.c:351:19: error: 'GPIO_TypeDef' has no member named 'BSRRL'
stm32f_stpdrv.c:353:19: error: 'GPIO_TypeDef' has no member named 'BSRRL'

6 REPLIES 6
Posted on September 06, 2013 at 00:41

No it's more practically that it's a 32-bit register and writing both the set/clear portions atomically with a 32-bit write is considered more advantageous.

32-bit BSRR replaces split 16-bit BSRRL and BSRRH in the structure. There are still 16 pins per bank.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ee06091
Associate III
Posted on September 06, 2013 at 01:22

But is it a F4 feature, right? Because including the F3 header it doesn't appear as a member :s

ee06091
Associate III
Posted on September 06, 2013 at 01:33

It is not a F3 but a F1 :s

this is my includes:

#include

<stm32f10x.h>

#include

<stm32f10x_rcc.h>

#include

<stm32f10x_gpio.h>

#include

<stm32f10x_tim.h>

Posted on September 06, 2013 at 01:34

In both cases it's a 32-bit register in the GPIO peripheral, and it can be written either with 16-bit or 32-bit accesses. I don't know why the C model changes, but the 32-bit atomic write to set/clear multiple bits is very compelling.

*((uint32_t *)&GPIOx->BSRRL) = 0xFF0000FF; // F4 equivalent to F3 GPIOx->BSRR

They could I suppose have used unnamed structs/unions but historically that's been a bit unportable.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 06, 2013 at 01:37

Now you're throwing in the F1, where it's documented to be only 32-bit (word) writable.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ee06091
Associate III
Posted on September 06, 2013 at 03:51

There are an equivalent for F1

F4              ->        F1

BSRRL               BSRR

BSRRH              BRR

thanks 🙂