Skip to main content

Subsection 8.3.2 Status-Register Access Types

RM0490 §1.2, List of abbreviations for registers, defines the access-type labels printed under every bit of every register description. The ones this course meets:
Table 8.3.2. Register access types (RM0490 §1.2)
Label Meaning How software clears it
rw Read/write Write any value
r Read-only Software cannot: hardware manages it
rc_w0 Read; clear by writing 0 (writing 1 has no effect) Assign a mask with 0 at the flag: REG = ~FLAG;
rc_w1 Read; clear by writing 1 (writing 0 has no effect) Assign a mask with 1 at the flag: REG = FLAG;
rs Read; software can set by writing 1; writing 0 has no effect Not by writing; §1.2 defines only the write-0-has-no-effect behavior (ADEN, ADSTART)
The habit worth keeping: clear status flags by assigning the mask, never by read-modify-write. The assignment is correct for both polarities. &= ~ is destructive on rc_w1 bits, and on rc_w0 bits it is safe only as long as no other flag in the register is raised between the read and the write-back, and the label in the reference manual is the only way to know which polarity you have.
One honest footnote on REG = ~FLAG: the mask also writes 1s into the register’s reserved bits, which RM0490 §1.2 says to keep at their reset value. It is safe on this family’s timer status registers, it is what ST’s own low-level driver does, but reserved-bit behavior is worth checking per register rather than assumed.