mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-12-14 16:18:54 -05:00
uart: Make CTS active low, as per the standard
This commit is contained in:
parent
74e3d74c11
commit
1a47a2266f
3 changed files with 9 additions and 4 deletions
|
|
@ -24,6 +24,11 @@ in order to hit the center of the bits. For example, a clock of 18 MHz
|
||||||
and a target bit rate of 62500 bps yields:
|
and a target bit rate of 62500 bps yields:
|
||||||
Divisor = 18E6 / 62500 = 288
|
Divisor = 18E6 / 62500 = 288
|
||||||
|
|
||||||
|
The UART core includes hardware flow control in the form of two CTS
|
||||||
|
lines. One input that the core will check before sending bytes, and
|
||||||
|
one output to signal to a connected device that the internal FIFO is
|
||||||
|
full. The CTS are active-low.
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ module uart (
|
||||||
end
|
end
|
||||||
|
|
||||||
ADDR_TX_STATUS: begin
|
ADDR_TX_STATUS: begin
|
||||||
tmp_read_data = {31'h0, core_txd_ready & ch552_cts_reg[1]};
|
tmp_read_data = {31'h0, core_txd_ready & !ch552_cts_reg[1]};
|
||||||
end
|
end
|
||||||
|
|
||||||
default: begin
|
default: begin
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ module uart_fifo (
|
||||||
out_ptr_reg <= 9'h0;
|
out_ptr_reg <= 9'h0;
|
||||||
byte_ctr_reg <= 9'h0;
|
byte_ctr_reg <= 9'h0;
|
||||||
in_ack_reg <= 1'h0;
|
in_ack_reg <= 1'h0;
|
||||||
fpga_cts_reg <= 1'h1;
|
fpga_cts_reg <= 1'h0;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
in_ack_reg <= in_ack_new;
|
in_ack_reg <= in_ack_new;
|
||||||
|
|
@ -127,10 +127,10 @@ module uart_fifo (
|
||||||
end
|
end
|
||||||
|
|
||||||
if (byte_ctr_reg >= 9'd486) begin // FIFO is filled to ~95% or more
|
if (byte_ctr_reg >= 9'd486) begin // FIFO is filled to ~95% or more
|
||||||
fpga_cts_reg <= 0; // Signal to not send more data
|
fpga_cts_reg <= 1; // Signal to not send more data
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
fpga_cts_reg <= 1; // Signal to send more data
|
fpga_cts_reg <= 0; // Signal to send more data
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue