Forum Discussion
Altera_Forum
Honored Contributor
15 years agoNEEK Cyclone III edition problem
I am trying to create a simple project like Hello World or counter. I made a design but always getting error like;
Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Pausing target processor: OK Initializing CPU cache (if present) OK Downloading 02000000 ( 0%) Downloaded 20KB in 0.3s (66.6KB/s) Verifying 02000000 ( 0%) Verify failed between address 0x2000000 and 0x2004E0F Leaving target processor paused Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Processor is already paused Initializing CPU cache (if present) OK Downloading 02000000 ( 0%) Downloaded 20KB in 0.3s (66.6KB/s) Verifying 02000000 ( 0%) Verify failed between address 0x2000000 and 0x2004E0F Leaving target processor paused Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Processor is already paused Initializing CPU cache (if present) OK Downloading 02000000 ( 0%) Downloaded 20KB in 0.3s (66.6KB/s) Verifying 02000000 ( 0%) Verify failed between address 0x2000000 and 0x2004E0F Leaving target processor paused Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Processor is already paused Initializing CPU cache (if present) OK Downloading 02000000 ( 0%) Downloaded 20KB in 0.3s (66.6KB/s) Verifying 02000000 ( 0%) Verify failed between address 0x2000000 and 0x2004E0F Leaving target processor paused Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Processor is already paused Initializing CPU cache (if present) OK Downloading 02000000 ( 0%) Downloaded 20KB in 0.3s (66.6KB/s) Verifying 02000000 ( 0%) Verify failed between address 0x2000000 and 0x2004E0F Leaving target processor paused Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Processor is already paused Initializing CPU cache (if present) OK Downloading 02000000 ( 0%) Downloaded 20KB in 0.3s (66.6KB/s) Verifying 02000000 ( 0%) Verify failed between address 0x2000000 and 0x2004E0F Leaving target processor paused I tried to attached my project file but i think it has big size to attach. Could you help me please..17 Replies
- Altera_Forum
Honored Contributor
Anyway, thanks for help Cris72 but finally i gave up trying. i changed my kit.
Now im working with DE2-70 and my design works. but i have new problem like, ../hello_world.c: In function `test1_led': ../hello_world.c:24: error: `IOWR_ALTERA_AVALON_PIO_DATA' undeclared (first use in this function) ../hello_world.c:24: error: (Each undeclared identifier is reported only once ../hello_world.c:24: error: for each function it appears in.) ../hello_world.c:24: warning: left-hand operand of comma expression has no effect ../hello_world.c:26: error: `PIO_RED_LED_BASE' undeclared (first use in this function) ../hello_world.c:26: error: syntax error before "led_mask" ../hello_world.c:28: warning: implicit declaration of function `usleep' ../hello_world.c:30:2: warning: no newline at end of file ../hello_world.c:30: error: syntax error at end of input my code; # include "system.h" # include "altera_avalon_pio_regs.h" # include "alt_types.h" void test1_led(void){ alt_u32 led_mask=0; while(1){ // green led control // red led control (IOWR_ALTERA_AVALON_PIO_DATA, led_mask); PIO_RED_LED_BASE // toggle led led_mask ^= 0xFFFFFFFF; // sleep 0.2 second usleep(200*1000); } // while - Altera_Forum
Honored Contributor
What is this?!? :confused: It should be:(IOWR_ALTERA_AVALON_PIO_DATA, led_mask); PIO_RED_LED_BASE
Also make sure that PIO_RED_LED_BASE is the correct define name for the pio (refer to system.h).IOWR_ALTERA_AVALON_PIO_DATA(PIO_RED_LED_BASE, led_mask); - Altera_Forum
Honored Contributor
Actually, i dont know how to use variables in Nios II codes.
in my SOPC design; "led" and "switch" are my pio names so can you help me how to read value or position of switches and how can i change values of leds. - Altera_Forum
Honored Contributor
Look into system.h file.
You'll find the *_BASE defines for every sopc peripheral. Use those of led and switch pio ports to read and write pio status. For example if these were LED_BASE and SWITCH_BASE you write: IOWR_ALTERA_AVALON_PIO_DATA(LED_BASE, led_mask); to set led status sw = IORD_ALTERA_AVALON_PIO_DATA(SWITCH_BASE); to get switch status - Altera_Forum
Honored Contributor
#define LED_PIO_NAME "/dev/led_pio"
# define LED_PIO_TYPE "altera_avalon_pio" # define LED_PIO_BASE 0x04404880 # define LED_PIO_SPAN 16 # define LED_PIO_DO_TEST_BENCH_WIRING 0 # define LED_PIO_DRIVEN_SIM_VALUE 0x0000 # define LED_PIO_HAS_TRI 0 # define LED_PIO_HAS_OUT 1 # define LED_PIO_HAS_IN 0 # define LED_PIO_CAPTURE 0 # define LED_PIO_EDGE_TYPE "NONE" # define LED_PIO_IRQ_TYPE "NONE" # define LED_PIO_BIT_CLEARING_EDGE_REGISTER 0 # define LED_PIO_DATA_WIDTH 8 # define LED_PIO_FREQ 85000000 # define ALT_MODULE_CLASS_led_pio altera_avalon_pio in system.h file; led is defined as given above - Altera_Forum
Honored Contributor
Then, what's the problem? You have to write:
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, led_mask); Examples: IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0xffff); All LEDs on IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0); All LEDs off IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0x0003); Turn on LEDs connected to pio pins 0 and 1, off the others IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0x050c0); Turn on LEDs connected to pio pins 2,3,8,10, off the others - Altera_Forum
Honored Contributor
I just did succesfully before i read what you post.
Now i am trying to read button values My fool. I added keys on my SOPC design but i was trying to control leds with switches. :) Thanks again Cris. I am appreciated.