Forum Discussion
Altera_Forum
Honored Contributor
10 years agoAbout VGA Output
Hello,
I am working for the first time with FPGA (cyclone v soc) and i am trying to get a output from VGA Port on the monitor. I have set the resolution for 1024x768 and PLL input frequency as 50MHz and output frequency as 65MHz as required for the resolution.But as soon as i program the board the monitor is going to sleep mode. I am attaching the code which i used for this. Can you please tell me what may be the problem. When I checked in RTL Simulation PLL is not generating any clock output. Thank you in advance. Code: ----Main code LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.NUMERIC_STD.ALL; ENTITY VGA IS PORT( CLOCK_24: IN STD_LOGIC; SYS_rst : IN STD_LOGIC; VGA_HS, VGA_VS: OUT STD_LOGIC; VGA_R, VGA_G, VGA_B: OUT STD_LOGIC_VECTOR(7 DOWNTO 0); VGA_CLK_65MHZ : OUT STD_LOGIC ); END VGA; ARCHITECTURE MAIN OF VGA IS SIGNAL VGACLK, RESET, lock : STD_LOGIC :='0'; signal SIGNAL_135MHZ : STD_LOGIC:= '0'; COMPONENT SYNC IS PORT ( CLK : IN STD_LOGIC; HSYNC, VSYNC : out std_logic; R, G, B : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) ); END COMPONENT; component unsaved is -- PLL Component port ( pll_0_locked_export : out std_logic; -- pll_0_locked.export pll_0_outclk0_clk : out std_logic; -- clk pll_0_refclk_clk : in std_logic := '0'; -- clk pll_0_reset_reset : in std_logic := '0' -- reset ); end component unsaved; BEGIN inst_pll : UNSAVED port map ( pll_0_refclk_clk => clock_24, pll_0_reset_reset => SYS_rst, pll_0_outclk0_clk => VGACLK, ---CLOCK 65 MHZ --outclk_1 => SIGNAL_135MHZ, --- CLOCK 135 MHZ pll_0_locked_export => lock ); INST_SYNC : SYNC PORT MAP ( CLK => VGACLK, HSYNC => VGA_HS, VSYNC => VGA_VS, R => VGA_R, G => VGA_G, B => VGA_B ); VGA_CLK_65MHZ <= VGACLK; END MAIN; ---Sub Program LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.NUMERIC_STD.ALL; ENTITY SYNC IS PORT( CLK : IN STD_LOGIC; HSYNC, VSYNC : out std_logic; R, G, B : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) ); END SYNC; ARCHITECTURE MAIN OF SYNC IS SIGNAL HPOS: INTEGER RANGE 0 TO 1344:=0; SIGNAL VPOS: INTEGER RANGE 0 TO 806:=0; BEGIN PROCESS(CLK,HPOS,VPOS) BEGIN IF(CLK' EVENT AND CLK='1') THEN IF (HPOS = 832 OR VPOS = 422) THEN R <= (OTHERS => '1'); G <= (OTHERS => '1'); B <= (OTHERS => '1'); ELSE R <= (OTHERS => '0'); G <= (OTHERS => '0'); B <= (OTHERS => '0'); END IF; IF(HPOS<1344) THEN HPOS <= HPOS+1; ELSE HPOS <=0; END IF; IF (VPOS<806)THEN VPOS <= VPOS+1; ELSE VPOS <=0; END IF; END IF; IF (HPOS > 24 AND HPOS < 160)THEN HSYNC <= '0'; ELSE HSYNC <= '1'; END IF; IF (VPOS > 3 AND VPOS < 9) THEN VSYNC <= '0'; ELSE VSYNC <= '1'; END IF; IF ((HPOS> 0 AND HPOS< 320) OR (VPOS>0 AND VPOS< 38)) THEN R <= (OTHERS => '0'); G <= (OTHERS => '0'); B <= (OTHERS => '0'); END IF; END PROCESS; END MAIN;28 Replies
- Altera_Forum
Honored Contributor
hello,
I connected my FPGA board to monitor through VGA cable. Before programming when i connect the board to the monitor its showing the default logo of Altera FPGA board. As soon as i download the program into the board the monitor is going to power saving mode. I am using DELL LCD monitor E1912HC. - Altera_Forum
Honored Contributor
You're missing my point, pnayak15. Look at the pinout for a VGA connector:
https://en.wikipedia.org/wiki/vga_connector That pinout certainly does not match your FPGA output. This is an analog interface, not DVI/HDMI as I suspected. So your FPGA output is driving the input to a video encoder chip on your board. Please find out what that chip is, get a data sheet, and make sure you're using the chip correctly (giving it all of the proper input signals that it needs). - Altera_Forum
Honored Contributor
Hello sir,
The VGA chip I am using is 'ADV7123' 10-bit video DAC. Since I am very new to VHDL programming and FPGA board I'll take little more time to understand you. I will heck those things told by you and get back to u soon in case if I need any further help. Please bear with me. - Altera_Forum
Honored Contributor
pnayak15 -
Ok, now we're getting somewhere. It sounds like you have an Altera dev kit. And when you power up the board the dev kit displays the Altera logo on the monitor. Do you have the source code for the FPGA design that came with the board? Normally that is provided with a dev kit. If you have that then look at it and see what's different from what you're doing, especially how sync is generated. The ADV7123 does not take VSYNC and HSYNC, which is what you are generating. It needs composite sync, which is basically VSYNC and HSYNC combined into one signal, with a few specific differences. Once you drive SYNC/ correctly you should get an image. And you'll also need to drive the BLANK/ signal high. Good luck, you're getting close! Bob - Altera_Forum
Honored Contributor
Hi
Yeah exactly I have that Altera DE kit. I have to see about that source code and also I will work on that combined hsync and vsync signal. Thank you sir. If anything I could not find please help me.. Regards Prashant - Altera_Forum
Honored Contributor
hello,
I didnt get source code for VGA along with the board. do we have to include that sync and blank signals in our program???? - Altera_Forum
Honored Contributor
Prashant -
It looks like you don't need to generate composite sync after all. Vsync and Hsync go directly to the VGA connector. But both the SYNC/ and BLANK/ inputs to the ADV7123 are driven by the FPGA so you have to do something with them. Read the ADV7123 data sheet. And you can download the FPGA source code from TerasIC if you have an account. You have all the information you need to make this work, and you're close. Not much else I can do for you. Maybe this video will help: https://www.youtube.com/watch?v=wk5ft5rd1su Bob - Altera_Forum
Honored Contributor
hello,
Thank you so much sir for your help. I will try with that and get back to you. Regards, Prashanth