Altera_Forum
Honored Contributor
11 years agoMy onw lights example is crashing
Hi.
I created my own example project from a altera introduction pdf to use some buttons and leds. Thats the link to the tutorial ftp://ftp.altera.com/up/pub/altera_material/9.1/tutorials/verilog/introduction_to_the_altera_sopc_builder.pdf. My board is the Altera Cyclone III DK-N2EVAL-3C25N NIOSII Development Board. Here an screenshot of the SOPC builder window. https://www.alteraforum.com/forum/attachment.php?attachmentid=9119 Generating and compiling of the code works fine. Here the verilog code: --- Quote Start --- module lights (SW, KEY, CLOCK_50, LEDG); input [3:0] SW; input [0:0] KEY; input CLOCK_50; output [3:0] LEDG; // Instantiate the Nios II system module generated by the SOPC Builder: // nios_system (clk, reset_n, out_port_from_the_LEDs, in_port_to_the_Switches) nios_system NiosII (CLOCK_50, KEY[0], LEDG, SW); endmodule --- Quote End --- In the example are 8 leds and button used, my board has only 4 so I changed that in the sopc builder and in the code to 4 and connected the in/outputs in the pin planer. Took the pin information from another project which works. https://www.alteraforum.com/forum/attachment.php?attachmentid=9120 My nios code is: --- Quote Start --- # include <stdio.h> # define Switches (volatile char *) 0x0003000# define LEDs (char *) 0x0003010 int main() { printf("Hello from Nios II!\n"); while (1) *LEDs = *Switches; return 0; } --- Quote End --- But when I run the nios project it crashes with that error message: --- Quote Start --- Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Processor is already paused Reading System ID at address 0x0C002F40: verified Initializing CPU cache (if present) OK Downloading 05000020 ( 0%) Downloading 05010000 (26%) Downloading 05020000 (53%) Downloading 05030000 (79%) Downloaded 242KB in 0.6s (403.3KB/s) Verifying 05000020 ( 0%) Verifying 05010000 (26%) Verifying 05020000 (53%) Verifying 05030000 (79%)assertion "m_state == STATE_DEBUG" failed: file "nios2debug.cpp", line 578..... --- Quote End --- I have no idea why. Even when i remove the most stuff and use only a while(1) without anything it crashes. The reason must be in the quartus part, because the nios c code works with other projects but not with my own example.