While debugging UART transmission, I've noticed that upon writing a byte into UART_TDR register in the debugger, two bytes have been transmitted with a relatively long spacing in between them. The second byte was zero.
To me, this indicates, that the debugger decided to write the UART_TDR register as two bytes.
This particular debugging session was using gdb using OpenOCD as transport layer and STLink-V2 as the debugging interface. UART_TDR is declared to be half-word in the CMSIS-mandated header (as 9 bits may be needed in some settings), which through .elf/dwarf is used as basis for debugging in this environment. Using a type-punning cast of this register to either byte or word removed the problem and resulted in a single byte transmission.
It may be quite well that the problem occurs only in a particular combination/version/setting of these tools, or may have been result of some particular circumstances. In other words, this article is not to say, that this particular debugging tool combination is flawed, but that users have to exercise caution when using debuggers, generally. Debuggers do many non-trivial things under the hood, and they may not be always aware of requirements to treat the non-memory-like registers with care. This of course could result in problems not only in UART Tx, but the issue has a particularly conspicuous outcome there.
In "visual" debuggers, the registers' layout is not given by the CMSIS-mandated header, rather, by a dedicated file (.svd). Such file is likely to have fields for both halfword- and byte-wide registers, so the problem is quite naturally rectified there.