My LED is not blinking - My first NIOS II software tutorial - EP4CE6E22C8N
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:
https://johnloomis.org/NiosII/pio/PIO_example1.html
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.
#include <stdio.h>
#include "system.h"
#include "altera_avalon_pio_regs.h"
int main()
{
int Srout = 0x1;
int delay;
printf("Ola... vamos piscar LEDs..!\n");
while(1)
{
IOWR_ALTERA_AVALON_PIO_DATA(PIO_LED_BASE, Srout );
delay = 2000000;
//printf("Teste LED");
while (delay>0)
{
delay--;
}
printf("%d \n",Srout);
Srout = Srout << 1;
if (Srout >= 0x100)
Srout = 0x1;
}
return 0;
}
Where is my mistake? Maybe my board is not compatible with this tutorial, or with this library?