I recently purchased a Terasic DE2-70 Cyclone II development board. The makers have two prices: $599 commercial and $349 academic. If you’re a college student, the academic price is still too much. After I got a job, made some money, and saved up, I sent the Taiwanese company Terasic a little email. I told them I recently graduated and wanted to get the academic price, stating that I would be using it for personal learning, etc. They were more than happy to offer the discount, so I’m now the proud owner of a DE2-70. (By the way, they ship from Taiwan – viz. $40 shipping from the other side of the world.)
Well, having gone through Altera’s “Introduction to the Altera SOPC Builder Using VHDL Design” to remember how to use the software, I found multiple problems with the tutorial as it is. I hope that listing the solutions here will help people in the same situation. Some of these issues are obvious, and some are a bit more subtle.
I am using Quartus II 7.2 and NiosII 7.2.
- In Step 1: “In your project, choose the EP2C35F672C6 chip as the target device, because this is the FPGA on the DE2 board”. Well, the DE2-70 uses a different chip. Choose the EP2C70F896C6. This can be verified by simply looking at the text printed on the FPGA.
- In Step 1: “You can choose a different directory or project name, but be aware that the SOPC Builder software does not permit the use of spaces in file names”. This is true and I just wanted to make it obvious that you can’t have a space *anywhere* in the pathname. For example, you would have problems in SOPC Builder if your project was in “C:\Program Files\…” since that path contains a space.
- In Step 6: “In the On-Chip Memory Configuration Wizard window, shown in Figure 8, set the memory width to 32 bits and the total memory size to 4 Kbytes”. As I’ll be getting to shortly, the 4kB is not enough for the NiosII project. Crank it up to 64kB for plenty of breathing room.
- In Step 7: The PIO is under Peripherals -> Microcontroller Peripherals -> PIO (Parallel I/O).
- In Step 9: The JTAG UART is under Interface Protocols -> Serial -> JTAG UART.
- After Step 11: Write down the base addresses of the PIOs after auto-assigning the addresses. These will be needed for NiosII, as they are treated as memory-mapped I/O.
- Before Step 12: There are a couple “To Do”‘s in the message window of SOPC Builder about the NiosII CPU that need to be addressed: the reset and exception vectors. Double-click the NiosII component you instantiated to open up the properties window you were at before. Now that you have on-chip memory instantiated, click on the Reset Vector and Exception Vector Memory drop-down boxes and select the name of your memory (e.g. “onchip_mem”). Leave the offsets the way they are (0x0 and 0x20). Don’t worry about the “Warning: Switches: PIO inputs are not hardwired in test bench. Undefined values will be read from PIO inputs during simulation.”, this tutorial doesn’t do any test benches.
- Importing DE2_70_pin_assignments.csv. This comma-separated file is located on the DE2-70 CD included with the kit, and it can also be found on the internets. Mmm, google. The naming convention for this Altera-supplied file changed from DE2 to DE2-70. Open it and take a look. There are now lower-case ‘i’s and ‘o’s before many of the hard-wired signals denoting them as input and output. Remember this! The HDL code needs to change reflecting this. Otherwise the .csv needs changing, but I don’t suggest it. Here’s my resulting code (remember, the port names may be different for your SOPC component):
- LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
USE ieee.std_logic_unsigned.all;ENTITY lights IS
PORT (
iSW : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
iKEY : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
iCLK_50 : IN STD_LOGIC;
oLEDG : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
);
END lights;ARCHITECTURE Structure OF lights IS
COMPONENT nios_system is
port (
— 1) global signals:
signal clk : IN STD_LOGIC;
signal reset_n : IN STD_LOGIC;— the_LEDs
signal out_port_from_the_LEDs : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);— the_Switches
signal in_port_to_the_Switches : IN STD_LOGIC_VECTOR (7 DOWNTO 0)
);
END COMPONENT;BEGIN
NiosII: nios_system PORT MAP(iCLK_50, iKEY(0), oLEDG, iSW);
END Structure;
- LIBRARY ieee;
- Before Section 3.2: If you’ve tried to do a full compilation at this point, you will probably see an unexpected error:
- Error: Can’t place pins assigned to pin location Pin_AD25 (IOC_X95_Y2_N1)
Info: Pin iSW[7] is assigned to pin location Pin_AD25 (IOC_X95_Y2_N1)
Info: Pin ~LVDS195p/nCEO~ is assigned to pin location Pin_AD25 (IOC_X95_Y2_N1)
Error: Can’t fit design in device
Error: Quartus II Fitter was unsuccessful. 2 errors, 3 warnings
Info: Allocated 215 megabytes of memory during processing
Error: Processing ended: Sun Oct 18 19:11:13 2009
Error: Elapsed time: 00:00:03
Error: Quartus II Full Compilation was unsuccessful. 2 errors, 152 warnings - Here is the fix:
- In Quartus-II select menu Assignments>Device…
- Select button “Device and Pin Options…”
- Select the tab “Dual-Purpose Pins”
- Under the list of “Dual-purpose pins:” change the “Value” property of nCEO to “Use as regular I/O”.
- Click OK
- Error: Can’t place pins assigned to pin location Pin_AD25 (IOC_X95_Y2_N1)
- After Section 3.2: If you are using the Web edition or didn’t buy the full license for the Altera IP, you probably got a pop-up window after programming the device stating “OpenCore Plus Status Click Cancel to stop using OpenCore Plus IP. Time remaining: unlimited”. Do not close this window if you intend on using the NiosII IDE to run on the hardware. Just leave the window up and close when you are done, or have a problem with Quartus or SOPC Builder.
- I skipped over the Assembly programming section because this tutorial already gave me a headache. I’m not a masochist.
- In Section 4.2: When you create a new project, create it in the following way: File -> New -> Project… and select “Nios II C/C++ Application”. Also, use the Hello World template. It sets everything up for you, gives you printf functionality to the console, but takes up a bit more space.
- lights.c: Here’s what I have in my file. Again, it might be a bit different for the base addresses.
- #include <stdio.h>
#define Switches (volatile char*) 0x21000
#define LEDs (char*) 0x21010int main()
{
printf(“Hello from Nios II!\n”);
while (1){
*LEDs = *Switches;
}
return 0;
}
- #include <stdio.h>
- After all of that is done, you right-click on your project in NiosII IDE (e.g. hello_world_0) and click “Run As -> Nios II Hardware”.
- Done! You can now move the switches (SW7 – 0) and see the LEDG7-0 change. You can also reset the CPU using KEY0.
I know how frustrating it can be trying to learn something when the tutorial is wrong. Hope this helps!
July 26, 2010 at 1:42 pm
Thanks Jeremy, this saved me a lot of time!
A small addition to save others even more time: the “Altera Debug Client” which is being referenced to in this tutorial, is now branded “Altera Monitor Program”. Its part of the “University Program Design Suite”, which can be downloaded here:
http://university.altera.com/materials/tools/upds/
November 17, 2010 at 10:13 am
thank you very much;
I have just one error at the end when I would like to compile my C source code.
error : *LEDs = *Switches;
syntax error before numeric constant.
do you have any idea ?
Thanks.
KH
November 21, 2010 at 6:16 pm
KH:
Are you sure you included the necessary #defines at the beginning of your C code?
Check the syntax and let me know if you still have problems.
March 12, 2011 at 10:55 am
Thanks for this. This was a nice find after spending a few hours trying to port some DE2 designs to the DE2-70…
March 12, 2011 at 10:55 am
Thanks for this. This was a nice find after spending a few hours trying to port some DE2 designs to the DE2-70…
March 23, 2011 at 4:24 pm
I had a same warning with khalil.
same warning: syntax error before numeric constant
August 2, 2011 at 4:51 pm
Hmm, not sure what’s going on. In English here’s what is supposed to happen:
“Switches” points to memory location 0x21000, and “LEDs” points to memory location 0x21010. “*LEDs = *Switches;” gets the value at the memory location referenced by “Switches” and put it at the memory location referenced by “LEDs”.
If you are still getting stuck, I’ll try to do this project again and see if I get the same error. One thing you might try is wrapping LEDs and Switches in parentheses:
*(LEDs) = *(Switches);
January 8, 2013 at 5:38 am
hello,
i am currently working on DE2 70 altera kit for my final year project and want to send messages using ethernet port. i am working using SOPC builder. Firstly i want to run a small program(eg. LEDs). i have created a NIOS II system using SOPC builder, then i have used altera monitor program to compile a c program.
system got downloaded on to the board but when i m trying to load it i am getting the following error.
Using cable “USB-Blaster [USB-0]”, device 1, instance 0x00
Pausing target processor: not responding.
Resetting and trying again: FAILED
Leaving target processor paused
please kindly help me to sort this error.
April 9, 2013 at 1:59 pm
Hello, I’m having the same problem as ‘jamiaditya’, I would love to know if you solved the problem, and how if possible. Thank you
February 5, 2014 at 6:04 pm
Try set top entity for lights.vhd and recompile the whole thing.
June 3, 2016 at 2:38 am
It is very nice.
July 27, 2016 at 7:15 am
Great tutorial! Thank’s
October 1, 2016 at 3:24 am
Hi. I am having the same problem as Khalil as follows:
error : *LEDs = *Switches;
syntax error before numeric constant
It got resolved after including:
#define Switches (volatile char*) 0x21000
#define LEDs (char*) 0x21010
Thanks for the suggestion. :)
January 6, 2017 at 11:55 am
Hi, I do think this is a great blog. I will revisit once again since i have saved as a favorite it.
June 16, 2017 at 12:25 am
Interesting! I really admired you passion of posting thank you for this one. really happy to see your article
February 26, 2018 at 8:57 pm
The passion for writing articles is impressed and the way you presented it well. Thanks, and post furthermore articles.
April 2, 2018 at 1:43 am
The passion for writing articles is impressed and the way you presented it well. Thanks, and post furthermore articles.
April 17, 2018 at 2:27 am
The only thing that I look into a page is professionalism, credibility and the ability to communicate. This is a very nice post, a page that has been well contemplated on before being shared. It’s a great thing to know that there are solutions where proms arise. Meanwhile, if you are looking for SOP writing help let your main objective be to find the best assistance there is. That is where we come in, to deliver the most relevant assistance.
June 13, 2018 at 8:43 pm
OMG thanks man
This rectified my problem
After Section 3.2: If you are using the Web edition or didn’t buy the full license for the Altera IP, you probably got a pop-up window after programming the device stating “OpenCore Plus Status Click Cancel to stop using OpenCore Plus IP. Time remaining: unlimited”. Do not close this window if you intend on using the NiosII IDE to run on the hardware. Just leave the window up and close when you are done, or have a problem with Quartus or SOPC Builder.
August 17, 2018 at 6:39 am
Great website over here
August 20, 2018 at 3:31 am
Hello there, I recently joined my dream school to pursue my dreams of becoming a doctor. I consulted Statement writing help who have the best admission essay writers . They helped me write admission essay document at a relatively fair price. Try them and you be assured you will get the best admission essay.
October 10, 2018 at 9:47 pm
succes all
January 15, 2019 at 5:58 am
Hekimlerin yazdığı ilaçları gündüz tüm eczaneler açık olduğu için kolayca temin edebiliriz. Yalnız mesai saatleri dışında ise tüm eczaneler kapanır. Yalnız nöbetçi eczaneler kalır. Konya’daki nöbetçi eczaneleri de https://www.nobetcieczanebul.com/konya-nobetci-eczane web sitesinden öğrenip kolayca ulaşabilirsiniz.
February 18, 2019 at 3:53 pm
Great post. I like this post. Thanks for sharing this useful information.
February 26, 2019 at 11:54 am
I now know days there are a lots number of tutorial services available but I prefer https://www.5bucksessay.com/ which is a very quick l tutorial help services.
March 11, 2019 at 11:04 pm
Hi, I do think this is the great blog. I will read this once again since i have saved as favorite one.Thanks For sharing and keep sharing like this blog.
March 11, 2019 at 11:07 pm
I actually like these postit’s been really a good tutorial on this software .Keep sharing like this tutorial and Blogs.I would like to see you again.
March 17, 2019 at 7:13 pm
Great website over here
March 18, 2019 at 3:58 am
Konferans koltuğu üretimi yapan firmamız, en kaliteli koltuk modelleri ile yanınızda yer alıyor.
March 19, 2019 at 10:35 pm
Thank you so much for this information.
April 12, 2019 at 4:33 am
Thanks
htttp://melekdenizi.com
April 18, 2019 at 7:06 am
..
July 7, 2019 at 1:15 pm
Good work!
Thanks.
July 16, 2019 at 12:35 am
Hi
Thank you for provide this wonderful list of problem and solution and waiting for more updates
July 16, 2019 at 12:37 am
It was really great
September 17, 2019 at 10:45 am
Everything is very open and very clear explanation for step by step keep moving, waiting for more updates, thank you for sharing with us. Now you can watch more popular videos on Onmovies App
September 17, 2019 at 10:45 am
Everything is very open and very clear explanation for step by step keep moving, waiting for more updates, thank you for sharing with us.
September 17, 2019 at 11:27 am
This is an incredible rousing article.I am essentially satisfied with your great work.You put truly exceptionally accommodating data. Keep it up. Continue blogging. Hoping to perusing your next post. ghd sports download
September 17, 2019 at 11:28 am
I always receive the best information from your site. So, I feel that your site is the best. I am waiting for new information from you. Thanks for your great site.I thought of sharing the updated list of website here that should help you further and are not limited. thoptv
September 17, 2019 at 11:29 am
I think I am able to do that after reading this post here. You know a lot about business promotion. I appreciate your knowledge. ghd sports
October 2, 2019 at 2:30 am
this my first ever comment on your website and I hope this won’t be the last anyway thanks for sharing such good post the information you shared was really helpful.
October 3, 2019 at 8:16 am
this is a great article
October 3, 2019 at 8:44 am
my fav fighting game
October 3, 2019 at 8:47 am
play the game and enjoy
October 10, 2019 at 1:03 am
The post explores DE2-70 SOPC Tutorial Introduction – a list of problems and solutions. It mentions that having got through Altera’s Introduction to the Altera SOPC Builder Using VHDL Design to memorize how to bring into play the software, the author could find various problems with the tutorial.
Thanks,
https://essayschief.com
November 5, 2019 at 3:21 am
اگر به دنبال ترجمه متون فارسی خود برای اهدافی مانند مدارک مهاجرت، ارسال مقاله به نشریات خارجی به دنبال مترجمانی کارکشته، با تسلط کامل بر زبان انگلیسی هستید تا متن شما به سرعت با بهترین کیفیت و نازل ترین قیمت به شما ارائه شود ترجمه آنلاین در خدمت شماست. ترجمه آنلاین با کادری از باسابقه ترین مترجمان و ارزان تر از همه جا ترجمه تخصصی فارسی به انگلیسی متون شما را انجام میدهد.
November 13, 2019 at 10:12 am
Can you show me more of it? I am really interested in this. Would appreciate your kind response.
December 3, 2019 at 11:03 pm
new collection of 2020 the best jewelry, various kind of necklace for women, and all of them have discounts with unbelievable percent, best prices ever, check it out
December 25, 2019 at 11:22 am
Many of the people and sites are not like you where they provide solutions to the people freely and reasonable solutions are really needed. Thanks.
December 25, 2019 at 11:24 am
Many of the people and sites are not like you where they provide solutions to the people freely and reasonable solutions are really needed. Thanks from https://bestdissertationexperts.co.uk/
January 8, 2020 at 12:30 am
Thanks for the write up!
Indeed a fitness routine helps you release stress and stay active throughout the day. One should always take out time for a quick workout session.