There are two different versions of STM32F4 headers released by ST, with some incompatibilities. The one that comes with the StdPeriph library defines 16 bit BSRRL
and BSRRH
, that is the one you have. The other one that comes with the STM32CubeF4 library has a single 32 bit BSRR
definition, which corresponds to the reference manual.
Now check the definition in your headers
__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 */
BSRRL
corresponds to the low half, bits 0-15 of the BSRR
register as described in the reference manual, which sets the corresponding output bit to 1 (high).
BSRRH
corresponds to the high half, bits 16-31 of the BSRR
register, which sets the corresponding output bit to 0 (low).
You can use BSRRL
instead of BSRR
to turn a pin on, but keep in mind that the definition is only 16 bits, so you can't turn some bits on and some other pins off in a single operation using this definition, because the writes are truncated to 16 bits by the compiler.
BSRRL
has the same function of BRR
, the only difference is that the write is truncated to 16 bits by the compiler, nothing that you have to worry about unless you must count the cycles to get some timing right.