From 2d9711986e8efdf089459e7fc608fa8691efb2d7 Mon Sep 17 00:00:00 2001
From: Tristan Gingold <tristan.gingold@cern.ch>
Date: Tue, 30 Nov 2021 09:53:52 +0100
Subject: [PATCH] Fix blinking led

---
 hdl/top/sf2-test/sf2_test.vhd | 7 ++++---
 hdl/top/sf2-test/uart.vhd     | 2 --
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/hdl/top/sf2-test/sf2_test.vhd b/hdl/top/sf2-test/sf2_test.vhd
index 911cd93..bed17f1 100644
--- a/hdl/top/sf2-test/sf2_test.vhd
+++ b/hdl/top/sf2-test/sf2_test.vhd
@@ -125,7 +125,7 @@ begin
     if rising_edge(clk_100) then
       if rst_n = '0' then
         led1_o <= '1';
-        led2_o <= '1';
+        led2_o <= '0';
       else
         led1_o <= counter (25);
         led2_o <= counter (23);
@@ -136,7 +136,7 @@ begin
   iram_addr <= iahb_addr (IRAM_LOG_SIZE + 2 - 1 downto 2);
   iram_data <= ahb_rdata;
 
-  proc_uart: process (clk_100)
+  proc_init: process (clk_100)
   begin
     if rising_edge(clk_100) then
       iahb_start <= '0';
@@ -150,7 +150,7 @@ begin
         case state is
           when INIT_DELAY =>
             iahb_addr <= (others => '0');
-            if counter = x"000_0010" then
+            if counter = x"0c0_0000" then
               state <= READ_NVM;
               counter <= (others => '0');
             else
@@ -171,6 +171,7 @@ begin
               end if;
             end if;
           when DONE =>
+            counter <= counter + 1;
             cpu_rst_n <= '1';
         end case;
       end if;
diff --git a/hdl/top/sf2-test/uart.vhd b/hdl/top/sf2-test/uart.vhd
index 4c9c925..c08220c 100644
--- a/hdl/top/sf2-test/uart.vhd
+++ b/hdl/top/sf2-test/uart.vhd
@@ -9,8 +9,6 @@
 library ieee;
 use ieee.std_logic_1164.all;
 
-library smartfusion2;
-use smartfusion2.all;
 ----------------------------------------------------------------------
 -- uart entity declaration
 ----------------------------------------------------------------------
-- 
GitLab