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!
January 11, 2020 at 10:01 am
Great article. Looking to hear more from you.
September 9, 2020 at 1:48 am
good essay. The most accurate information I know.
February 11, 2020 at 10:53 pm
Nice Blog. Thanks dear for sharing this interesting information with us and put your thoughts in this blog.
February 11, 2020 at 11:01 pm
Amazing Article sir, Thank you for giving the valuable Information really awesome.
February 12, 2020 at 4:42 pm
amazing post and really lovely, nice information you have
https://www.teknoxhaber.com/
February 20, 2020 at 7:49 am
BEST REGARDS https://thoptvapp.com/
February 20, 2020 at 7:49 am
Good article https://thoptvapp.com/
February 20, 2020 at 7:53 am
Nice article https://thoptvapp.com/
February 29, 2020 at 10:42 am
You wrote a very good information and added a some good points here..
March 11, 2020 at 4:14 pm
Very informative article and We provide a assignment creating services in reasonable price Do my assignment for me
March 11, 2020 at 4:15 pm
Very informative article and We provide a assignment creating services in reasonable price https://www.domyassignmentforme.com
March 17, 2020 at 11:48 am
App store optimization (ASO) is a buzz-word these days. And if you have no idea what it is, let me start with a short anecdote. Do you remember the time (nearly a few years ago) when the term Search Engine Optimization (SEO) appeared? Few people knew a thing about it back then. As of now, a lot of people know what SEO is and a lot of them use it to improve their websites’ search rankings.
As you might have already guessed, while SEO works mostly for websites, ASO is something that has to boost app visibility in Google Play, App Store, etc.
March 31, 2020 at 8:32 am
Thanks a lot for sharing this great solution. I really loved this content. It is so much pleasure!
Keep it up
Bookmarked
April 25, 2020 at 4:03 am
Thanks for the thorough article, keep posting such awesome blogs.
April 30, 2020 at 8:54 am
Thank you for sharing this useful article information.I am really impressed with the article you provided.
April 30, 2020 at 8:54 am
Thank you for sharing article and information. this is very helpful for beginner.
May 1, 2020 at 3:11 am
The content of your article page is very good, I find the content quite good and helpful to me, thank you for
May 1, 2020 at 3:12 am
The content of your article page is very good, I find the content quite good and helpful to me, thank you for
May 5, 2020 at 9:16 am
you have great post and also know more that its best to the day
May 16, 2020 at 2:27 pm
Thank you for this info keep share with us
May 29, 2020 at 2:35 am
Good post, Loved it ThopTv apk
May 29, 2020 at 2:36 am
very Good post, Loved it ThopTv apk
June 11, 2020 at 8:40 am
Hi, everybody! I’m a freelance author and I love my work because it motivates me to learn new things every day, to look for interesting articles and materials to grow my skill. I work with a team of professionals who never stop learning new things and refresh their skills.
June 16, 2020 at 12:34 am
read more and get the best things and read about it here
June 16, 2020 at 12:36 am
you can read as manythings you can read manythings and also read to know about how you can get the best things
June 16, 2020 at 6:03 am
top class article sir
June 16, 2020 at 6:04 am
top class article sir thanks for the information
June 26, 2020 at 9:45 am
Nice
June 26, 2020 at 9:45 am
Nice post
July 1, 2020 at 6:20 am
great post
July 1, 2020 at 6:21 am
top class article sir
July 1, 2020 at 6:22 am
Great to see tips and trick great work
July 6, 2020 at 9:09 am
Great tutorial! Thanks a lot for sharing your knowledge!
August 6, 2020 at 5:52 am
Im thankful for the blog post.Really looking forward to read more. Will read on
August 6, 2020 at 5:53 am
Hey, thanks for the blog article.Really looking forward to read more. Cool.
August 7, 2020 at 5:55 am
Thanks for sharing interesting blog topic
August 7, 2020 at 10:01 am
free samples
August 8, 2020 at 10:21 am
Thanks for shairing https://fortnitestwitems.com
August 20, 2020 at 5:55 pm
Great article, thanks for sharing.
شركة بناء بالكويت
August 20, 2020 at 5:55 pm
Great article, thanks for sharing.
August 25, 2020 at 11:59 pm
Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained!
September 7, 2020 at 1:05 am
Thanks for sharing great article.
September 8, 2020 at 11:53 pm
This is a great article thanks for sharing this informative information. I will visit your blog regularly for some latest article.
September 9, 2020 at 1:48 am
good essay. The most accurate information I know.
September 9, 2020 at 1:49 am
good essay. The most accurate information I know.
September 28, 2020 at 4:36 am
It’s no wonder that in recent years whatsapp became a huge part of our lives. It’s convenient quick and easy to use.
October 14, 2020 at 8:20 am
thanks for sharing this post.
شركة ترميم منازل بالكويت
October 14, 2020 at 2:35 pm
thanks for sharing.
شركة تنظيف خزانات بجازان
October 19, 2020 at 3:30 am
After the production companies and labels experienced the years of lost revenues in the CD sales, they decided to reinvent the contracts’ agreements. Read bout the The 360-Degree Deals in the Music Industry here https://prime-essay.net/samples/Research/the-360-degree-deals-in-the-music-industry-essay.html
October 23, 2020 at 5:22 am
great and useful post.
October 28, 2020 at 8:53 pm
pucing palak beby