FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5892 Discussions

EP3C120F780 Character LCD not cooperating

Altera_Forum
Honored Contributor II
1,395 Views

Kit: Altera Dev Kit EP3C120F780 

 

I am attempting to get the Character LCD working with NIOS II control. According to the documentation if I have set it up correctly then a simple printf() statement will redirect to the Character LCD. 

 

I have a SOPC set up with a NIOS 2 Processor, On-Chip memory, a JTAG UART, and a Character LCD. I clocking at 100Mhz from a PLL. (It began as the VIP megafunction reference design that I have stripped down.) I have wired the lcd_0 outputs to the pins like this... 

 

LCD_E_from_the_lcd_0 --> lcd_csn [PIN_AB24] 

LCD_RS_from_the_lcd_0 --> lcd_d_cn [PIN_D27] 

LCD_RW_from_the_lcd_0 --> lcd_wen [PIN_AC4] 

LCD_data_to_and_from_the_lcd_0[7..0] --> lcd_data[7..0] [PIN_AA4, AD1, V8, AB5, AE2, V5, V6, AB3] 

 

In the NIOS II I have made sure to have the system library direct stdout to lcd_0 instead of the jtag_uart. A printf() prints no text. No reaction whatsoever from the LCD. 

 

There is a configuration or initialization I am missing. I do NOT have "Reduced device drivers" checked, because the LCD drivers do not provide small drivers. 

 

Although this involves NIOS II, I ask this here because it's device specific to the Character LCD megafunction by Altera and my particular dev kit. 

 

William Guynes
0 Kudos
16 Replies
Altera_Forum
Honored Contributor II
630 Views

Have a look at my post here (http://www.alteraforum.com/forum/showthread.php?t=2609). The documentation for the Cyclone III development kit is wrong: the enable signal for the character LCD is pin AC24, not AB24.

0 Kudos
Altera_Forum
Honored Contributor II
630 Views

Thank you. I have now changed that pin. This evidently was not my only problem. The Character LCD still refuses to react. Still looking for possible problems. 

 

I have built a flashing LED in with my clock to show that the design is definitely running. 

 

William Guynes
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

I got it. My cpu_resetn was wrong, causing the NIOS II to not get started up. This became obvious when my blinker was dutifully showing me the circuit was working but the NIOS did nothing. 

 

Thanks for your help! 

 

William Guynes
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

Hi, 

 

do you have an example for the character LCD? The LCD doesn't react.
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

It appears I do not have attachment privileges anywhere on the site. I can see what valid file extensions are, but it never actually lets me choose an attachment filename. 

 

I also don't have any WYSIWYG or enhanced editing ability either, even though I configure them in User Control Panel. 

 

William Guynes
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

Dear William, 

 

can you send it by mail? 

 

mark@hellmanns.de 

 

Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

I fixed it. There was a spelling error (lcd_d_wen instead of lcd_wen). 

 

Thank you all.
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

Hello Mr William Guynes, 

 

I need some help to understand how the character LCD works with Nios control. I need to start somewhere earlier to understand. I just want to display output of arithmetic module to the lcd.  

From the output of the module, how do I connect it to the Nios control? Is the Nios instantiated from the Megafunction, and available in the web edition? 

 

If I can at least know how it works roughly I can go about trying it out. 

 

Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

I use the following code for Cyclone II. I suppose should be the same for Cyclone III using HAL. 

 

Hope it helps. 

# include <stdio.h> # include "system.h"  

 

///// LCD control: //////////////////////////////////////////////////////  

// From: http://www.altera.com/support/examples/nios2/exm-micro_mutex.html  

// ESC sequences:  

// From: http://www.isthe.com/chongo/tech/comp/ansi_escapes.html  

// ESC[#;#H Moves the cursor to line# , column#  

// ESC[2J Clear screen and home cursor  

// ESC[K Clear to end of line # define ESC_TOP_LEFT "[1;0H" # define ESC_BOTTOM_LEFT "[2;0H" # define LCD_CLR "[2J" # define LCD_CLR_LINE "[K"  

static unsigned char ESC = 0x1b; // Integer ASCII value of the ESC character  

 

void LCD_hello(void)  

{  

FILE* LCD;  

 

LCD = fopen ("/dev/lcd", "w");  

 

if (LCD == NULL) {  

printf("LCD open failed\n");  

} else {  

printf("LCD open succeeded\n");  

 

fprintf(LCD, "%c%s", ESC, LCD_CLR); // Clears LCD  

fprintf(LCD, "LCD demo using\n");  

fprintf(LCD, "Altera HAL in C");  

}  

 

fclose (LCD);  

}
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

hi to everyone! 

i'm newbie with all the altera quartus/nios stuff. i have a dsp cyclone III dev kit (EP3C120F780). 

 

I'm trying to show some characters on the lcd, but it doesnt work and i dont know whats wrong with my design. i 've used sopc to build up the system, and this is how it looks: 

 

http://img197.imageshack.us/img197/1317/nios.jpg  

 

I've tried to put the enable signal to the lcd on both pins (ab24 and ac24), but the lcd doesnt shows anything. The code i'm using it's the one that jrierab posted some days ago. 

 

does anyone have an idea of what's wrong in my design? 

 

thanks so muck in advance.
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

LCD_data_to_and_from_the_lcd_display needs to be bi-directional....not an output. 

 

Cheers, 

 

- Ura
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

problem solved. 

 

uraslacker, thank you so much for your answer. i know that pins must be bidirecctional, but i read somewhere that we couldnt read from the lcd display, only write to, so because of that i declared that pins as output only! :)
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

Hi All 

 

I'm having a very similar problem, and maybe for you could be easier to help me to solve: 

I can't perform a right association between LCD and NIOS into vhdl code main project that create the connection between entities. 

In particular I can't exactly understand why SOPC builder create the following interface for LCD: 

component lcd_0 is  

port ( 

-- inputs: 

address : IN STD_LOGIC_VECTOR (1 DOWNTO 0); 

begintransfer : IN STD_LOGIC; 

clk : IN STD_LOGIC; 

read : IN STD_LOGIC; 

reset_n : IN STD_LOGIC; 

write : IN STD_LOGIC; 

writedata : IN STD_LOGIC_VECTOR (7 DOWNTO 0); 

-- outputs: 

LCD_E : OUT STD_LOGIC; 

LCD_RS : OUT STD_LOGIC; 

LCD_RW : OUT STD_LOGIC; 

LCD_data : OUT STD_LOGIC_VECTOR (7 DOWNTO 0); 

readdata : OUT STD_LOGIC_VECTOR (7 DOWNTO 0) 

); 

end component lcd_0; 

 

How can I connect all these "signals" with processor? 

Could anyone help me? 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

The connection between the LCD component and the Nios CPU needs to be done inside SOPC builder, not outside. Connect the LCD's avalon slave interface to the Nios data master.

0 Kudos
Altera_Forum
Honored Contributor II
630 Views

Hi  

 

really thanks to all.. Same minutes after posted this issue I've understood the issue and create the right assignment.  

Quartus compilation now working fine but NIOS still create issue, I hope by using suggestion in the forum to solve final issue on LCD. 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
630 Views

Hi All 

 

I'm not using printf() but AVALON messages in order to send to LCD characters. After iniziliztion procedure I can see on LCD very strange characters, how is it possible? 

with default SW on DE0 board LCD working properly but I'm not so sure if LCD pinout could provide on LCD a very strange set of characters instead of normals. 

Could someone help me? 

Thanks
0 Kudos
Reply