I'm attending a university course on real time systems and we are using the STM32F10xxx MCU family for labs and examples. Every GPIO port has an Output Data Register (ODR) and a set/reset register (BSRR). In the manual it says that BSRR should be used to atomically set/reset single bits, "so there is no risk an IRQ occurs between the read and modify access".
If I understand this statement correctly it means that if I do something like
GPIOB->ODR |= (1UL<<3) a read and write on the ODR is necessary, so an interrupt might occur in between and, to avoid that, it would be better to use BSRR to set the relevant bits... am I right?
The question is: what if I want to set all the pins on the ODR register in an atomic way? For example does the instruction
GPIOB->ODR = 0x00000002 run atomically? In this case there is no need to read the value of the register, I'm simply setting all the bits to a specific value... is this write operation atomical or can it be interrupted? The only thing I found on the manual is "the I/O port registers have to be accessed as 32-bit words", but I don't know if this implies something about atomicity...
Can you help me? I'm completely new to this, so forgive me if the answer is trivial. I've found a lot of similar questions, but none of them clarified my doubts.