Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,358 Views

User LEDs 2 - 4 on NEEK, Cyclone III

NEEK Cyclone III 

cycloneIII_3c25_niosII_standard_sopc.sopcinfo 

 

How do I blink LEDs 2 - 4? Below code blinks LED1.  

 

Also, any references to documents where I could have figured this out by my self would be extremely useful. 

 

Thanks. 

 

# include <stdio.h># include "system.h"# include "altera_avalon_pio_regs.h" int main() { printf("Hello from Nios II!\n"); int count = 0; int delay; while(1) { IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, count & 0x01); delay = 0; while(delay < 2000000) { delay++; } count++; } return 0; }
0 Kudos
6 Replies
Altera_Forum
Honored Contributor I
73 Views

The PIO port is connected to the LEDS on the board. Each bit in the PIO port corresponds to an LED. So if you change the one line to read: 

 

IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, count & 0x03); 

 

You should get two leds blinking ... oh the excitement. :) Amazing how rewarding the blinking of a little light can be. 

 

Jake
Altera_Forum
Honored Contributor I
73 Views

Thanks for the reply. 

 

Ok. At least I'm not going crazy... I tried that prior to posting and only LED 1 blinks. I thought maybe I was doing something wrong. Here's my system.h. The DATA_WIDTH field looks wrong to me. 

 

/* * led_pio configuration * */ # define ALT_MODULE_CLASS_led_pio altera_avalon_pio# define LED_PIO_BASE 0x8000190# define LED_PIO_BIT_CLEARING_EDGE_REGISTER 0# define LED_PIO_CAPTURE 0# define LED_PIO_DATA_WIDTH 2# define LED_PIO_DO_TEST_BENCH_WIRING 0# define LED_PIO_DRIVEN_SIM_VALUE 0x0# define LED_PIO_EDGE_TYPE "NONE"# define LED_PIO_FREQ 60000000u# define LED_PIO_HAS_IN 0# define LED_PIO_HAS_OUT 1# define LED_PIO_HAS_TRI 0# define LED_PIO_IRQ -1# define LED_PIO_IRQ_INTERRUPT_CONTROLLER_ID -1# define LED_PIO_IRQ_TYPE "NONE"# define LED_PIO_NAME "/dev/led_pio"# define LED_PIO_RESET_VALUE 0x0# define LED_PIO_SPAN 16# define LED_PIO_TYPE "altera_avalon_pio"
Altera_Forum
Honored Contributor I
73 Views

I did look at the example project that I have (which is a bit old) and it seems the led pin assignments are a bit goofy. 

 

LED0 is P13 (correct) 

LED1 is T1 (not correct, goes to HSMC connector) should be N12 

LED2 is N12 - should be P12 

LED3 is N9 (correct). 

 

If memory serves, I believe they did this because of some conflict with the DDR pins (too many pins toggling near a VREF pin). 

 

Jake
Altera_Forum
Honored Contributor I
73 Views

How does that translate to the right call to get the other LEDs to light? 

IOWR_ALTERA_AVALON_PIO_DATA
Altera_Forum
Honored Contributor I
73 Views

You have to change the pin assignment in Quartus. You can open the Pin Planner and find which pins the "top_led" signals are connected to. But it still doesn't explain why the other 2 LEDs aren't lighting up. 

 

I have a NEEK at home. I'll have to look at it later tonight. 

 

Jake
Altera_Forum
Honored Contributor I
73 Views

Who can help me? I now have a ISP1362's IP core, but the version too old, in the Quartus9.0 can not be used. Who have the latest version of the ISP1362's IP core? Can sent me a? dang390254944@qq.com

Reply