Altera_Forum
Honored Contributor
14 years agoNIOS II + Character LCD + DE0 Nano = Problem!
Hi all,
I have spent my entire weekend trying working on the character LCD module provided as a display peripheral with NIOS II, and i am going nowhere with it! Here is my situation; SOPC build using NIOSII/f cpu, and character LCD, SDRAM, sysid, jtag_uart, and other few peripherals like led and stuff. I assigned pins for my LCD as following; set_location_assignment PIN_F13 -to LCD_RS set_location_assignment PIN_T15 -to LCD_E set_location_assignment PIN_T13 -to LCD_DATA[0] set_location_assignment PIN_T14 -to LCD_DATA[1] set_location_assignment PIN_T12 -to LCD_DATA[2] set_location_assignment PIN_R13 -to LCD_DATA[3] set_location_assignment PIN_T11 -to LCD_DATA[4] set_location_assignment PIN_R12 -to LCD_DATA[5] set_location_assignment PIN_R11 -to LCD_DATA[6] set_location_assignment PIN_T10 -to LCD_DATA[7] I have grounded the LCD_RW pin as i dont plan on reading anything from the LCD. Following is my main.c;#include <stdio.h>
# include "system.h"
# include "altera_avalon_pio_regs.h"
# include "altera_avalon_lcd_16207_regs.h"
# include "altera_avalon_lcd_16207.h"
int main(){
char ch = '\0';
FILE *lcd_d = 0;
lcd_d = fopen(LCD_DISPLAY_NAME, "w");
printf("LCD & Keypad Test!\n");
//altera_avalon_lcd_16207_init(LCD_DISPLAY_BASE);
printf("Address of LCD: %s\n", LCD_DISPLAY_NAME);
while(1){
ch = kbd_getc();
usleep(9);
if(ch != 0){
printf("%c ", ch);
fprintf(lcd_d, "Hello LCD");
}
}
return (0);
} I have all the stderr, stdin and stdout pointed to jtag_uart. I tried pointing it to LCD, but still no luck I dont have Reduced Driver selected nor do i have reduced C library selected. In my BSP, i can see the driver for LCD. in the alt_sys_init.c file in my BSP project folder, i can also see the altera_avalon_lcd_16207_init(LCD_NAME, lcd_name) is called. And i am guessing that this initializes my LCD. altera_avalon_lcd_16207.c is also included in my system. So when i print fprintf(lcd_d, "Hello World"); it prints nothing. It is not even initializing my LCD. Any help would be greatly appreciated! I have spent way too much time on this and i know i am missing some stupid thing! Thank you PK