UART

6.0 The UART Transceiver

This is the last chapter of this tutorial, At this point we have built the baud generator subcircuit, transmitter subcircuit and receiver subcircuit. We will now connect them together as shown in the diagram below using VHDL. For geeks who do not use logisim should note that ports with round or circular shapes are output ports while square-headed ports are input. The circuit has been tested on quartus on modelsim and works perfectly fine.
You would notice that the receiver and transmitter share a different baud generator instead of one, this is because of the oversampling at the receiver, The receiver resets the baud The_counter immediately it receives a '0' or a start bit and this could interrupt the transmitter , so a seperate clock generator is made for them. A seperate appication will be developed at the end of the project to demonstrate how they work

UART transceiver.

--------------------------------------------------------------------------------
-- PROJECTFPGA.COM
--------------------------------------------------------------------------------
-- NAME:    UART TRANSCEIVER
--------------------------------------------------------------------------------
-- AUTHORS: Ezeuko Emmanuel <ezeuko.arinze@projectfpga.com>
--------------------------------------------------------------------------------
-- WEBSITE: https://projectfpga.com/uart
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- UART TRANSCEIVER FOR FPGA
--------------------------------------------------------------------------------
-- Copyright (C) 2020 projectfpga.com
--
-- This source file is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This source file is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------------


library ieee;
use ieee.std_logic_1164.all;

entity transceiver is
  port(
    reset, ready, rx_bit, received_in, sent_in, clock: in std_logic;
	 baud_select : in std_logic_vector(2 downto 0);
	 dout : in std_logic_vector(15 downto 0);
    error, received_ok, sent_ok, txbit : out std_logic;
	 din : out std_logic_vector(18 downto 0)
  );
end transceiver;

architecture structure of transceiver is

  component baud_generator
port(
  baud_select : in  std_logic_vector(2 downto 0);
  clr_clk, reset, clock : in  std_logic;
   baud_clock : out std_logic);
    end component;

	  component transmitter
port(
  dout : in  std_logic_vector(15 downto 0); --data to be transmitted
  rts : in  std_logic;--set by receiver to tell transmitter to start sending data
  baud_clock : in  std_logic;--The baud clock, will be used instead of main clock
  reset , error: in  std_logic;
  txbit: out std_logic;
  sent_ok: out std_logic);
    end component;


	  component receiver
port(
   received_ok: out std_logic;
  rx_bit : in  std_logic;--The received bit
  baud_clock : in  std_logic;--The baud clock, will be used instead of main clock
  reset : in  std_logic;
  error, ready: in std_logic;
  clr_clk: out std_logic;--resets the baud_clock to zero
    din : out  std_logic_vector(18 downto 0));
    end component;


  signal s_clr_rx, tx_baud_clock, s_sent_ok, s_error, s_received_ok: std_logic;
  signal s_clr_clk, rx_baud_clock: std_logic;

begin

s_error <= (sent_in xor s_received_ok)  or (received_in xor s_sent_ok) ;

  eq_bit0: baud_generator
    port map (baud_select, s_clr_rx, reset, clock, tx_baud_clock);


  eq_bit1: baud_generator
    port map (baud_select, s_clr_clk, reset, clock, rx_baud_clock);


  eq_bit2: transmitter
    port map (dout=>dout, rts=>ready,
	 baud_clock=>tx_baud_clock, reset=>reset, error=>s_error,
	 txbit=>txbit, sent_ok=>s_sent_ok);

	   eq_bit3: receiver
    port map (rx_bit=>rx_bit, baud_clock=>rx_baud_clock, error=> s_error, ready => ready,
	 reset=>reset, received_ok=>s_received_ok, clr_clk=>s_clr_clk, din=>din);

end structure;









John Doe
2:26:15pm On 2018.12.24
can we implement this code in xilinx software. if we can do that that plz help me to verify it on xilinx..
John Doe
9:58:25pm On 2018.10.8
how to make changes in UART_TX.v file if I want to give an input (to the transmitter) from the code itself? eg.) I want to give input "ABC12" as input to the transmitter?.
John Doe
9:3:29am On 2018.11.11
Some tutorials show writing FSM logic with next state combination logic. Can you explain why they do this. Doesn t seem like you have that model here for your UART FSM. Thanks.
John Doe
0:39:34pm On 2018.12.13
Is there the opportunity to send files from fpga to computer? For example I implement in vhdl code to produce hex files where I have some information about the export data. First of all is this synthesizable ? And if it is can I export this file from UA.
John Doe
11:08:28pm On 2022.09.26
calf column vampire <a href=http://bag33ondu.com>bag33ondu.com</a> <a href= http://bag33ondu.com >bag33ondu.com</a> http://bag33ondu.com bridle header haggle .
John Doe
06:00:34pm On 2022.09.30
hamilelikte kilo kaybД± neden olurbГ¶brek yetmezliДџinde kilo kaybД± <a href="https://anti-tpo-nedir-yuekseklii-kilo-kayb.thehottrader.online/">anti tpo nedir yuksekligi kilo kayb?</a> kabД±zlД.
John Doe
06:05:57pm On 2022.10.13
<a href="https://turhaberleri.online/">Türkiye Haberleri</a>.