| 1 | ----------------------------------------------------------------------------------
|
|---|
| 2 | -- Company: TU Dortmund, Lehrstuhl fuer experimentelle Physik 5b, Astroteilchenphysik
|
|---|
| 3 | -- Engineer: D.Neise
|
|---|
| 4 | --
|
|---|
| 5 | -- Create Date: April 2011
|
|---|
| 6 | -- Design Name:
|
|---|
| 7 | -- Module Name: fad_rs485_definitions
|
|---|
| 8 | -- Project Name:
|
|---|
| 9 | -- Target Devices:
|
|---|
| 10 | -- Tool versions:
|
|---|
| 11 | -- Description: library file for FAD design
|
|---|
| 12 | --
|
|---|
| 13 | -- Dependencies:
|
|---|
| 14 | --
|
|---|
| 15 | -- Revision:
|
|---|
| 16 | -- Revision 0.01 - File Created
|
|---|
| 17 | --
|
|---|
| 18 | -- Additional Comments:
|
|---|
| 19 | -- Many thanks to Q. Weitzel
|
|---|
| 20 | ----------------------------------------------------------------------------------
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 | library IEEE;
|
|---|
| 24 | use IEEE.STD_LOGIC_1164.all;
|
|---|
| 25 | use IEEE.STD_LOGIC_ARITH.ALL;
|
|---|
| 26 | -- use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
|---|
| 27 | -- use IEEE.NUMERIC_STD.ALL;
|
|---|
| 28 |
|
|---|
| 29 | package fad_rs485_constants is
|
|---|
| 30 |
|
|---|
| 31 | constant FAD_RS485_INPUT_CLK_F : integer := 50000000; -- 50MHz
|
|---|
| 32 | --communication with FTM
|
|---|
| 33 | constant RS485_BAUD_RATE : integer := 250000; -- bits / sec in our case
|
|---|
| 34 | constant RS485_MESSAGE_LEN_BYTES : integer := 7; -- @250kbaud --> 308us in total or (@50Mhz) 15400 clk cycles.
|
|---|
| 35 | -- notes about the timeout:
|
|---|
| 36 | -- the timeout is measured *after* the receiption of the 1st byte ... not after the 1st startbit.
|
|---|
| 37 | -- one byte consists of 1 startbit, 8 databits, 2 stopbit2 --> 11 bits in total.
|
|---|
| 38 | -- in order to have some ~10% contingency, we decided to put 13 bits instead of 11
|
|---|
| 39 | --
|
|---|
| 40 | -- so this timeout evaluates to 18200 clk cycles or 364us *after* the 1st byte was received.
|
|---|
| 41 | -- this means, one message is trunkated only, if it is longer than ~356us in total.
|
|---|
| 42 | -- this might be subject to changes.
|
|---|
| 43 | -- keep in mind that, there is an additional timeout
|
|---|
| 44 | constant RS485_TIMEOUT : integer := (RS485_MESSAGE_LEN_BYTES * 13) * (FAD_RS485_INPUT_CLK_F / RS485_BAUD_RATE);
|
|---|
| 45 |
|
|---|
| 46 | end fad_rs485_constants;
|
|---|