Skip to content

Commit

Permalink
Merge branch 'topic/stm32_uart' into 'master'
Browse files Browse the repository at this point in the history
Avoid losing input bytes in the UART on STM32F4xx.

Closes #117

See merge request eng/toolchain/bb-runtimes!152
  • Loading branch information
reznikmm committed Jan 28, 2025
2 parents 032500b + 6239ceb commit 589195b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/s-textio__stm32f4.adb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ package body System.Text_IO is

procedure Put (C : Character) is
begin
USART1_Periph.DR.DR := Character'Pos (C);
USART1_Periph.DR :=
(DR => Character'Pos (C),
others => 0);
-- By assigning all fields of the DR register we can be sure that the
-- compiler does not use the read-modify-write sequence, which resets
-- the SR.RXNE flag.
end Put;

----------------------------
Expand Down
7 changes: 6 additions & 1 deletion src/s-textio__stm32f469.adb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ package body System.Text_IO is

procedure Put (C : Character) is
begin
USART6_Periph.DR.DR := Character'Pos (C);
USART6_Periph.DR :=
(DR => Character'Pos (C),
others => 0);
-- By assigning all fields of the DR register we can be sure that the
-- compiler does not use the read-modify-write sequence, which resets
-- the SR.RXNE flag.
end Put;

----------------------------
Expand Down

0 comments on commit 589195b

Please sign in to comment.