Commit 185501ca authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

test: Bug-fix of TX from intermission.

When sending first bit of ID recessive and we did not send
SOF, we must force stuff count value to 1 (not to 2), because
this accounts only for the value of first bit of ID!
parent f0c8161c
...@@ -135,6 +135,7 @@ architecture rtl of bit_stuffing is ...@@ -135,6 +135,7 @@ architecture rtl of bit_stuffing is
signal same_bits_q : unsigned(2 downto 0); signal same_bits_q : unsigned(2 downto 0);
signal same_bits_add : unsigned(2 downto 0); signal same_bits_add : unsigned(2 downto 0);
signal same_bits_d : unsigned(2 downto 0); signal same_bits_d : unsigned(2 downto 0);
signal tx_no_sof_val : unsigned(2 downto 0);
-- Halt for CAN Core -- Halt for CAN Core
signal data_halt_q : std_logic; signal data_halt_q : std_logic;
...@@ -327,17 +328,25 @@ begin ...@@ -327,17 +328,25 @@ begin
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
same_bits_add <= (same_bits_q + 1) mod 8; same_bits_add <= (same_bits_q + 1) mod 8;
---------------------------------------------------------------------------
-- Preset value in case of start of transmission without transmission of
-- SOF (as result of Sampling dominant and considering this as SOF!):
-- 1. If we transmitt dominant, we put two, this accounts for SOF + first
-- transmitted bit of ID.
-- 2. If we transmitt recessive, we put one, this accounts only for first
-- transmitted bit of ID.
---------------------------------------------------------------------------
tx_no_sof_val <= "010" when (data_in = DOMINANT) else
"001";
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Next value for counter of equal consecutive bits: -- Next value for counter of equal consecutive bits:
-- 1. Set to 2 when transmission started without SOF and first bit of -- 1. Preset to special value when we don't transmit SOF!
-- Base ID is dominant! This accounts for SOF + Base ID (1)!
-- 2. Reset -- 2. Reset
-- 3. Increment if not reset when processing bit. -- 3. Increment if not reset when processing bit.
-- 4. Keep original value otherwise. -- 4. Keep original value otherwise.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
same_bits_d <= "010" when (tx_frame_no_sof = '1' and same_bits_d <= tx_no_sof_val when (tx_frame_no_sof = '1') else
data_in = DOMINANT) else
"001" when (same_bits_rst = '1') else "001" when (same_bits_rst = '1') else
same_bits_add when (bst_trigger = '1') else same_bits_add when (bst_trigger = '1') else
same_bits_q; same_bits_q;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment