Skip to content

Commit 63dc19d

Browse files
committed
Wait for STM32 timer output to be enabled before returning from enable procedure.
RM0386 Rev 6 22.3.12 notes that there may be a delay before the BDTR.MOE bit reads as 1 after writing to it. The RM says that only a single instruction is needed, but testing has shown that this is incorrect. With the previous code, calling Enable_Main_Output and then immediately calling a procedure to set a different part of the register could result in the MOE bit being inadvertently set low.
1 parent b651d01 commit 63dc19d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/ARM/STM32/drivers/stm32-timers.adb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ package body STM32.Timers is
184184
procedure Enable_Main_Output (This : in out Timer) is
185185
begin
186186
This.BDTR.Main_Output_Enabled := True;
187+
188+
loop
189+
exit when Main_Output_Enabled (This);
190+
end loop;
187191
end Enable_Main_Output;
188192

189193
-------------------------

0 commit comments

Comments
 (0)