2013-11-16 08:31 AM
to be migrated, sourceId: 35463:697285D7-A9CA-445D-B16C-F23BF0E3B1A3
#stm32f42013-11-16 09:58 AM
The application of the defines would be for a 32-bit cast of the register. ie *((uint32_t *)&GPIOx->BSRRL) = Mask; // Set and Reset combined
You don't read-modify-write the register (|=), the purpose is to do a single atomic write, logic behind the peripheral register handles the current settings of the ODR. Thus GPIOD->BSRRL = GPIO_Pin_12; GPIOD->BSRRH = GPIO_Pin_12;2013-11-16 10:09 AM
GPIO_Pin_12? if i don't want to use StandardPeriferalLibrary.
2013-11-16 10:16 AM
I said that GPIOD->BSRRH = GPIO_BSRR_BR_12 doesn't works. So there is maybe mistake in definitions of BR masks in the stm32f4xx.h. __IO uint16_t BSRRH and #define GPIO_BSRR_BR_12 ((uint32_t)0x10000000) . writing word (uint32_t) into halfword (uint16_t) has no effect.
2013-11-16 03:33 PM
Thus the use of the cast.
In other series parts a 32-bit BSRR is used, here it's split in Low and High portions, separating the set/reset halves. Pin 12 being (1 << 12), GPIO_Pin_12 is defined in stm32f4xx_gpio.h