+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Newbie level 5
    Points: 735, Level: 5

    Join Date
    Apr 2014
    Posts
    10
    Helped
    0 / 0
    Points
    735
    Level
    5

    RS232 vhd controller

    hello everybody,

    Iím trying to understand how is working the rs232 controller, and I thing I have understood nearly everything, the only thing I canít understand properly is how calculate the oversampling value to get the data, I mean the baud rate.
    Iím working with the digilentís code RS232RefComp.vhd (https://github.com/ibm2030/IBM2030/b...232RefComp.vhd) , at the line 76 is where the sampling rate is calculated, I copy/paste that line:

    constant baudDivide : std_logic_vector(7 downto 0) := "10100011"; --Baud Rate dividor, set now for a rate of 9600. Found by dividing 50MHz by 9600 and 16.

    When I do the same operation (50000000/9600)/16 it gives me = 325.5 which is aprox. the double than the one is at the code ("10100011" = 163) if I divide per 32 instead 16 the operations match with of the code.

    What Iím doing wrong? Whatís I missing?

    Thank you very much in advance.
    Regards.

    •   AltAdvertisement

        
       

  2. #2
    Full Member level 3
    Points: 1,650, Level: 9

    Join Date
    Jan 2012
    Posts
    155
    Helped
    58 / 58
    Points
    1,650
    Level
    9

    Re: RS232 vhd controller

    baudDivide is used to generate not CLK signal. So Actural TCLK frequency is 2* that name as u calculated.
    Anyway i discourage learning from that code. Gated clocks, state machines with wrong sensivity list etc.... there are much easier UART driver codes posted on net
    like this one http://www.bealto.com/fpga-uart_io.html


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  3. #3
    Super Moderator
    Points: 31,612, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,312
    Helped
    1719 / 1719
    Points
    31,612
    Level
    43

    Re: RS232 vhd controller

    Take a look at the clock generation it is probably toggling based on the baud rate.

    Regards


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  4. #4
    Newbie level 5
    Points: 735, Level: 5

    Join Date
    Apr 2014
    Posts
    10
    Helped
    0 / 0
    Points
    735
    Level
    5

    Re: RS232 vhd controller

    Thank you very much for you help and soon reply, I will have a look to the link.
    Thanks again.
    Regards.



  5. #5
    Advanced Member level 5
    Points: 14,946, Level: 29
    mrflibble's Avatar
    Join Date
    Apr 2010
    Posts
    2,724
    Helped
    687 / 683
    Points
    14,946
    Level
    29

    Re: RS232 vhd controller

    My favorite example for rs232:

    http://www.fpga4fun.com/SerialInterface.html

    The code used in that article is verilog, but a lot of useful hints in there that you can use directly in your vhdl design.



--[[ ]]--