2013-09-05 03:09 PM
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'
2013-09-05 03:41 PM
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.2013-09-05 04:22 PM
But is it a F4 feature, right? Because including the F3 header it doesn't appear as a member :s
2013-09-05 04:33 PM
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>
2013-09-05 04:34 PM
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.2013-09-05 04:37 PM
Now you're throwing in the F1, where it's documented to be only 32-bit (word) writable.
2013-09-05 06:51 PM
There are an equivalent for F1
F4 -> F1BSRRL BSRRBSRRH BRRthanks :)