Forum Discussion
11 Replies
- Altera_Forum
Honored Contributor
Create a PIO in your SOPC Builder / QSys project, and in the top level file in Quartus, connect this PIO port to the FPGA pins connected to the leds.
Then in your Nios II project you will have some macros to control the PIO port, defined in altera_avalon_pio_regs.h. - Altera_Forum
Honored Contributor
Thanks for reply,
But i got the error like PIO_LED_BASE undeclared(first use in this), altera_avalon_pio_regs.h:No such file or directory make :***[obj/defaults/hello_world.0]Error Any ideas? Alex. - Altera_Forum
Honored Contributor
Do you have a PIO in your SOPC/QSys system? Then the altera_avalon_pio_regs.h include file should automatically be included in the BSP.
What name did you give your PIO? The name to use is your PIO name, in capital letters, with a _BASE suffix. For example if you called it my_pio, you must use MY_PIO_BASE. - Altera_Forum
Honored Contributor
Thanks for prompt response, my PIO name is mismatched,now that problem solved, but when i run the program ,the output is
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] like this coming continously. Actually i wants to control leds on DE0_Nano board. Some times its showed errors also make:***[../Helloworld_bsp/-recurs-make-lib make[1]:*** [public.mk] Error1 Thanks, Alex. - Altera_Forum
Honored Contributor
What does your software project look like? Can we have a look at your main() function?
- Altera_Forum
Honored Contributor
Iam using Nios II 11.1 version,
My Nios Project is [#include <stdio.h># include"ststem.h># include "altera_avalon_pio_regs.h" int main() { printf("Hello form Nios II); int count=0; int delay; while(1) { IOWR_ALTERA_AVALON_PIO_DATA(PIO_LED_BASE, count & 0x01); delay=0; while(delay< 2000000) { delay++; } count++; } return 0; }] This is the my program, whre is the mistake? Thanks, Alex. - Altera_Forum
Honored Contributor
There are some mistakes in your code, I assume they come from a copy/paste error. The include line should be
and you didn't close the string in the printf line. You should also end the line with a \n to be sure it is written to the UART. Are you sure you upload the correct .sof image to the FPGA before you upload and run the software? And here is a tip: when you show some code, enclose it between [code] and [/code] tags, and you won't loose formatting and indentation.#include <system.h> - Altera_Forum
Honored Contributor
Sory for lack of my knowledge, i will tel what i did
1.Created a empty project in Quartus 11.1, under ubuntu. 2.Generated the system(SOPC builder)like sdram, altpll_sys,cpu,jtag_uart,timer_0, PIO_LED. 3.Created block and symatic diagram(In symatic diagram inputs is clock and reset remaing all those things are outputs) 4Eclipse--->program (previously which i posted in# 7) Now my problem is iam unable to run the Nios II program it showing error is elf file download failed, but .sof file is i downloaded correctly only, where is the mistake? Problem with my .sof file? Kindly any help ? Thanks, Alex. - Altera_Forum
Honored Contributor
Did you start the project from scratch? It can be a bit difficult to get some parameters right, such as the sdram. It is easier to start with a reference project from the kit DVD and add your own components from there.
- Altera_Forum
Honored Contributor
Thanks for ur help Sir,
I successfully running the uclinux on DE0_Nano board, after that i wants to add the feature of leds.I mean after running uclinux the leds should glow. For this nios2 Eclipse is enough or i need to get any other software? Kindly any help? Thanks, Alex.