Compare commits

...

2 Commits

Author SHA1 Message Date
b06ccdda2a fpga: Update UART baud rate to 250 kbaud/s 2024-08-09 11:31:59 +02:00
876693ca5f fpga: uart_wb: Latch received byte to allow late retrieval of data
Else, the CPU would get the part old / half current byte. This
enables boot loader baud rates in excess of 19200 baud.
2024-08-09 11:29:33 +02:00
3 changed files with 5 additions and 3 deletions

View File

@ -22,7 +22,7 @@ entity top is
-- System configuration -- System configuration
F_CLK : integer := 25000000; F_CLK : integer := 25000000;
F_CLK_PHY : integer := 50000000; F_CLK_PHY : integer := 50000000;
UART_BAUD : integer := 19200 UART_BAUD : integer := 250000
); );
port( port(
clk_50m : in std_logic; -- System clock clk_50m : in std_logic; -- System clock

View File

@ -41,6 +41,7 @@ architecture rtl of uart_wb is
signal status_register : std_logic_vector(31 downto 0); signal status_register : std_logic_vector(31 downto 0);
signal in_data : std_logic_vector(7 downto 0); signal in_data : std_logic_vector(7 downto 0);
signal in_data_latched : std_logic_vector(in_data'range);
signal in_data_valid : std_logic; signal in_data_valid : std_logic;
signal in_data_available : std_logic; signal in_data_available : std_logic;
@ -104,7 +105,7 @@ begin
out_data <= wb_i.dat(out_data'range); out_data <= wb_i.dat(out_data'range);
out_data_valid <= '1'; out_data_valid <= '1';
else else
wb_o.dat <= x"000000" & in_data; wb_o.dat <= x"000000" & in_data_latched;
in_data_available <= '0'; in_data_available <= '0';
end if; end if;
end if; end if;
@ -112,6 +113,7 @@ begin
if in_data_valid then if in_data_valid then
in_data_available <= '1'; in_data_available <= '1';
in_data_latched <= in_data;
end if; end if;
end if; end if;
end process wb_if; end process wb_if;

View File

@ -17,7 +17,7 @@ from ast import literal_eval
def eprint(*args, **kwargs): def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs) print(*args, file=sys.stderr, **kwargs)
ser = serial.Serial('/dev/ttyUSB0', 19200, timeout=2) ser = serial.Serial('/dev/ttyUSB0', 250000, timeout=2)
def sread(address, length, quiet = False): def sread(address, length, quiet = False):
if not quiet: if not quiet: