Merge pull request #265 from antonblanchard/another-spi-rxtx-reset-issu
authorAnton Blanchard <anton@linux.ibm.com>
Tue, 5 Jan 2021 09:17:37 +0000 (20:17 +1100)
committerGitHub <noreply@github.com>
Tue, 5 Jan 2021 09:17:37 +0000 (20:17 +1100)
Fix another reset issue in spi_rxtx

1  2 
spi_rxtx.vhdl

diff --combined spi_rxtx.vhdl
index f8dfb88659cbb43bc2f5127572c2bbc8964c43f6,13acdf367b3e2a4981502b88f12ecd26e152187d..b2de245413108ea9711586a9d4c5fd697ea68051
@@@ -177,6 -177,7 +177,7 @@@ begi
                  sck_send <= '0';
                  sck_recv <= '0';
                  clk_div  <= 0;
+                 counter := 0;
              elsif counter = clk_div then
                  counter := 0;
  
      count_bit: process(clk)
      begin
          if rising_edge(clk) then
 -            if start_cmd = '1' then
 -                bit_count <= cmd_clks_i;
 -            elsif state /= DATA then
 -                bit_count <= (others => '1');
 -            elsif sck_recv = '1' then
 -                bit_count <= std_ulogic_vector(unsigned(bit_count) - 1);
 +            if rst = '1' then
 +                bit_count <= (others => '0');
 +            else
 +                if start_cmd = '1' then
 +                    bit_count <= cmd_clks_i;
 +                elsif state /= DATA then
 +                    bit_count <= (others => '1');
 +                elsif sck_recv = '1' then
 +                    bit_count <= std_ulogic_vector(unsigned(bit_count) - 1);
 +                end if;
              end if;
          end if;
      end process;