Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > UART with fractional baudrate generator ? Or fractional baudrate generator alone

Reply
Thread Tools

UART with fractional baudrate generator ? Or fractional baudrate generator alone

 
 
Martin Maurer
Guest
Posts: n/a
 
      04-14-2006
Hello,

does someone have an UART with an fractional baudrate generator ? Or the
baudrate generator stand alone ? I search examples in VHDL.

Regards,

Martin


 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      04-14-2006
Martin Maurer wrote:

> does someone have an UART with an fractional baudrate generator ? Or the
> baudrate generator stand alone ? I search examples in VHDL.


Search for the identifier tic_per_bit_c
in the reference design source here:

http://home.comcast.net/~mike_treseler/

-- Mike Treseler
 
Reply With Quote
 
 
 
 
radarman
Guest
Posts: n/a
 
      04-15-2006
Having found a real lack of general purpose UART models, I wrote my own
in VHDL. They are a bit wasteful, in that the TX and RX units both
generate subtiming, but they were intended to be used separately. (I
have a project with an asymetric number of serial receivers and
transmitters)

You just supply the clock frequency as a generic, and the model
calculates the counter values for you. I've tested it at 24Mhz and
50MHz, but there is no reason you couldn't go higher. The model begins
to break down below about 12MHz, though. (sampling becomes a problem
with the way the dividers are set up.)

The models are designed to use FIFO's, but also provide RTS/CTS
support. Sadly, almost every FPGA board I've seen neglects hardware
flow control, despite using a MAX232 chip, which has the hardware to do
it. The FIFO's guarantee proper operation when flow control isn't an
option.

As for configuration, you supply the baudrate, parity, number of stop
bits, number of data bits on SLV's - which could be supplied by a
control module (which I have not written) that would implement the UART
control registers. Likewise, the models provide single signal error and
interrupt flags.

You might not be interested in the models themselves, but perhaps you
can use the sample rate generator logic. The models can correctly
handle baud rates up to 115k - and with a bit of modification, faster.

Email me at jshamlet<AT>hotmail<DOT>com if you would like a copy of
them.

 
Reply With Quote
 
Peter
Guest
Posts: n/a
 
      04-19-2006
Martin Maurer skrev:

> Hello,
>
> does someone have an UART with an fractional baudrate generator ? Or the
> baudrate generator stand alone ? I search examples in VHDL.
>
> Regards,
>
> Martin


Hi,

The baudrate generator could be written according to the example below:

Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.numeric_std.all;

Entity brgrx Is
Port(
clk : In Std_logic;
res : In Std_logic;
clkrx : Out Std_logic
);
End brgrx;

Architecture RTL Of brgrx Is

Signal brdiv : unsigned(8 downto 0); -- Counter
Signal iclkrx : std_logic; -- Internal CLKRX
Signal ubrr : unsigned(8 downto 0); -- div ratio
Signal toggle : std_logic; -- 351/352 control

Begin

-- Division control. Divide by 351 or 352 to get an average of 351,5

divctrl : Process (clk,res)
Begin
if res = '1' then
toggle <= '0';
elsif rising_edge(clk) then
if iclkrx = '1' then
toggle <= not toggle;
end if;
end if;
End process divctrl;

ubrr <= TO_UNSIGNED(351,9) when toggle = '1' else TO_UNSIGNED(350,9);


-- Divide by ubrr+1 i.e 351/352

divider : Process (clk,res)
Begin
if res = '1' then
brdiv <= (others => '0');
iclkrx <= '0';
elsif rising_edge(clk) then
if brdiv = ubrr then
brdiv <= (others => '0');
iclkrx <= '1';
else
brdiv <= brdiv + 1;
iclkrx <= '0';
end if;
end if;
End Process divider;

clkrx <= iclkrx;

End RTL;

Its not necessary to use two processes, they may be combined to a
single process. It would also be possible to make the toggle control
more complex, to accomplish an average divisor of e.g 351,25 or 351,75
(if the jitter is acceptable).

/Peter

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
baudrate generator kiran423 VHDL 9 04-17-2011 06:28 AM
Change BaudRate on Condition litechniks ASP .Net 0 03-18-2008 01:28 PM
PBX channelization over fractional T1 to fractional E1 WaRP Cisco 0 06-16-2005 01:30 PM
stand alone executable using pp doesn't stand alone Plotinus Perl Misc 2 12-17-2004 01:09 AM
UART Implementation Anand P Paralkar VHDL 2 07-07-2003 05:53 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57