Forum Discussion
help nios II
how can i do it in eclipse?
this is the project i want to accomplish. i have a 4x3 keypad that will serve as a source for my password that will display in the lcd then when the password is correct the solenoid will open or close but if the password is wrong the buzzer will buzz. the solenoid and buzzer are connected to gpio and the keypad also is connected to gpio. can you give me a pattern or something i can use to finish this project. thank you.13 Replies
- Altera_Forum
Honored Contributor
Hi, what did you already made ?
I presume you use NIOS II, SOPC or QSYS, an Altera dev board ? - Altera_Forum
Honored Contributor
yes i have these so far.
//======================================================= // This code is generated by Terasic System Builder //======================================================= module gpio1( //////////// CLOCK ////////// CLOCK_50, CLOCK2_50, CLOCK3_50, //////////// LED ////////// LEDG, LEDR, //////////// KEY ////////// KEY, //////////// LCD ////////// LCD_BLON, LCD_DATA, LCD_EN, LCD_ON, LCD_RS, LCD_RW, //////////// GPIO, GPIO connect to GPIO Default ////////// GPIO ); //======================================================= // PARAMETER declarations //======================================================= //======================================================= // PORT declarations //======================================================= //////////// CLOCK ////////// input CLOCK_50; input CLOCK2_50; input CLOCK3_50; //////////// LED ////////// output [8:0] LEDG; output [17:0] LEDR; //////////// KEY ////////// input [3:0] KEY; //////////// LCD ////////// output LCD_BLON; inout [7:0] LCD_DATA; output LCD_EN; output LCD_ON; output LCD_RS; output LCD_RW; //////////// GPIO, GPIO connect to GPIO Default ////////// inout [35:0] GPIO; //======================================================= // REG/WIRE declarations //======================================================= wire keyboard_val; matrixKeyboard_drive ( .i_clk(CLOCK_50), .i_rst_n(1), .row(GPIO[3:0]), // ???? ? .col(GPIO[7:4]), // ???? ? .keyboard_val(keyboard_val) // ??? ); //======================================================= // Structural coding //======================================================= assign LCD_BLON = 1'b1; assign LCD_ON = 1'b1; gpio ( .pio_led_export(LEDG), // pio_led.export .pio_gpio_solenoid_external_connection_export(GPIO[15:13]), // pio_gpio_solenoid_external_connection.export // pio_in.export .reset_reset_n(1), // reset.reset_n .lcd_data(LCD_DATA), // lcd.data .lcd_E(LCD_EN), // .E .lcd_RS(LCD_RS), // .RS .lcd_RW(LCD_RW), // .RW .clk_clk(CLOCK_50), // clk.clk .pio_key_export(KEY), // pio_key.export // pio_out.export .pio_gpio_buzzer_external_connection_export(GPIO[18:16]) // pio_gpio_buzzer_external_connection.export ); endmodule - Altera_Forum
Honored Contributor
and i'm using a de 2 cyclone IV board.
- Altera_Forum
Honored Contributor
what i did was add a module of a keypad in the quartus II is that right?
- Altera_Forum
Honored Contributor
Did you use Qsys to integrate the system? Is gpio1 top level module?
The code appears hand coded. It can work, but you need to import the gpio1 into Qsys. LCD and PIO can be readily integrated through Qsys. That is also where NIOS II, along with memory for instruction and runtime storage are instantiated. Since all components are available in Qsys, I am not sure why gpio1 has to be coded this way. After getting system constructed in Qsys, Eclipse IDE can be called out to work on software part. - Altera_Forum
Honored Contributor
yes i did. yes it is the top module. yes but in my top level i just add a module for the keypad and i'm having a problem in the eclipse because i'm not familiar to c programming used in eclipse.
thank you. - Altera_Forum
Honored Contributor
I think you need to explain clearer what you have. Gpio1 cannot be the top-level module. It has bits and pieces of a system, but incomplete. I don't see how it is connected to NIOS. What do you see in Quartus under Assignments->Settings->General->Top-level entity ?
- Altera_Forum
Honored Contributor
is this what you are referring? and the other file is a module generated by qsys.
what are the pieces missing that i shall add to finish my project? can you give some examples related to what i want to do please thank you. thank you for your help. in creating this project i used to follow the tutorial of my first nios II the blinking of led. - Altera_Forum
Honored Contributor
I was confused of gpio and gpio1. I see how the system is built now.
Seems ok with the system. Are you running it on a development board? Make sure the pins are assigned correctly. There are a few simple examples like "Hello world" or the one that blinks led. That can be used as a start in eclipse. Are those working? They are good to verify you are on the right track. - Altera_Forum
Honored Contributor
thank you sir.
if you dont mind sir, do you have any other examples that might help me aside from hello world and led that blinks? cause i'm just a newbie and i'm having hard time programming in the eclipse. thanks a lot