]> jspc29.x-matter.uni-frankfurt.de Git - trb3sc.git/commitdiff
Adding improved CS handling for LCD control.
authorJan Michel <j.michel@gsi.de>
Fri, 27 Nov 2015 10:26:17 +0000 (11:26 +0100)
committerJan Michel <j.michel@gsi.de>
Fri, 27 Nov 2015 10:27:34 +0000 (11:27 +0100)
code/lcd.vhd

index c033ce1b82e20230ebd1b85969ad1adb7a22a595..371562fcff7ffc1e60225ff772750404c424fe68 100644 (file)
@@ -316,6 +316,7 @@ fsm : process begin
         state   <= RSTCLEAR2;
         if cnt = 320*240*2-1 then
           state <= RSTFINISH;
+          timer <= (others => '0');
         end if;
       end if;
     when RSTCLEAR2 =>
@@ -327,6 +328,7 @@ fsm : process begin
         state   <= RSTCLEAR;
         if cnt = 320*240*2-1 then
           state <= RSTFINISH;
+          timer <= (others => '0');
         end if;
       end if;
     when RSTFINISH =>
@@ -335,8 +337,17 @@ fsm : process begin
       posrow  <= 0;
       datapos <= 32; --start of text section
       varcnt  <= 4;  --no nibble active
-      state   <= WAITSTART;
-      
+      if spi_idle = '1' then
+        CS <= '1';
+        if timer(4) = '1' then  --set CS again early enough
+          CS <= '0';
+        end if;
+        if timer = x"0000014" then 
+          state   <= WAITSTART;
+        end if;
+      else
+        timer <= (others => '0');
+      end if;  
 --------------------------------------------------------------      
 --  Write text from memory
 --------------------------------------------------------------     
@@ -370,6 +381,7 @@ fsm : process begin
         state <= WAITSTART1;
       elsif curdata = x"00" then   --end of string
         state <= RSTFINISH;
+        timer <= (others => '0');
       else                         --error, skip
         datapos <= datapos + 1;
         state   <= WAITSTART1;