I am following the My first NIOS II software tutorial, everything works but my LED does not blink.
I am using Cyclone IV EP4CE6E22C8N I have feedback in the NIOS II console
My qsys file:
I haven't found a lot of things about system.h and files besides this old tutorial:
I checked and part of the code was missing on altera_avalon_jtag_uart_regs.h file. So I added:
#define IOADDR_ALTERA_AVALON_PIO_DATA(base) __IO_CALC_ADDRESS_NATIVE(base, 0)
#define IORD_ALTERA_AVALON_PIO_DATA(base) IORD(base, 0)
#define IOWR_ALTERA_AVALON_PIO_DATA(base, data) IOWR(base, 0, data)
#define IOADDR_ALTERA_AVALON_PIO_DIRECTION(base) __IO_CALC_ADDRESS_NATIVE(base, 1)
#define IORD_ALTERA_AVALON_PIO_DIRECTION(base) IORD(base, 1)
#define IOWR_ALTERA_AVALON_PIO_DIRECTION(base, data) IOWR(base, 1, data)
#define IOADDR_ALTERA_AVALON_PIO_IRQ_MASK(base) __IO_CALC_ADDRESS_NATIVE(base, 2)
#define IORD_ALTERA_AVALON_PIO_IRQ_MASK(base) IORD(base, 2)
#define IOWR_ALTERA_AVALON_PIO_IRQ_MASK(base, data) IOWR(base, 2, data)
#define IOADDR_ALTERA_AVALON_PIO_EDGE_CAP(base) __IO_CALC_ADDRESS_NATIVE(base, 3)
#define IORD_ALTERA_AVALON_PIO_EDGE_CAP(base) IORD(base, 3)
#define IOWR_ALTERA_AVALON_PIO_EDGE_CAP(base, data) IOWR(base, 3, data)
However the LED still not blinking, the function works because I put a printf function inside the while to read Srout variable.
int Srout = 0x1;
printf("Ola... vamos piscar LEDs..!\n");
IOWR_ALTERA_AVALON_PIO_DATA(PIO_LED_BASE, Srout );
delay = 2000000;
Srout = Srout << 1;
if (Srout >= 0x100)
Srout = 0x1;
Where is my mistake? Maybe my board is not compatible with this tutorial, or with this library?
Hi Patricia Souza,
First of all, thank you so much for reaching us,
I'm Eliath and I'll help you with your issue.
Please give me a couple of days to review it carefully and give you an answer as soon as possible.
please take a look at the following document:
page 13 of the PDF, you can see the example code, similar to what you've done but the first argument of the function IOWR_ALTERA_AVALON_PIO_DATA () is no the same as the example design, which should be LED_PIO_BASE instead of PIO_LED_BASE.
These are macros and should match with the ones existing on the libraries used.
In section Debugging the Application , you will find a way to see if there is a mistake on connections or something else.
Please let me know if this worked for you.
Hoping you're doing well, I was wondering if the information shared with you was useful to solve your problem and if the issue is solved.
if you still have the same issue please let me know so I can help you with it.
if your issue has been solved, please let me know too so I can send the case to 'Close status', and after doing this, you'll have a period of 15 days to make a new post related to your issue.