Jeremy W. Langston

Personal Website

DE2-70 SOPC Tutorial Introduction – A list of problems…and solutions!

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.

  1. 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.
  2. 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.
  3. 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.
  4. In Step 7: The PIO is under Peripherals -> Microcontroller Peripherals -> PIO (Parallel I/O).
  5. In Step 9: The JTAG UART is under Interface Protocols -> Serial -> JTAG UART.
  6. 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.
  7. 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.
  8. 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;

  9. 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
  10. 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.
  11. I skipped over the Assembly programming section because this tutorial already gave me a headache.  I’m not a masochist.
  12. 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.
  13. 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*) 0x21010

      int main()
      {
      printf(“Hello from Nios II!\n”);
      while (1){
      *LEDs = *Switches;
      }
      return 0;
      }

  14. 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”.
  15. 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!

51 Comments

  1. 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/

  2. 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

    • jwlangston21

      November 21, 2010 at 6:16 pm

      KH:
      Are you sure you included the necessary #defines at the beginning of your C code?

      #define Switches (volatile char*) 0x21000
      #define LEDs (char*) 0x21010

      Check the syntax and let me know if you still have problems.

  3. Thanks for this. This was a nice find after spending a few hours trying to port some DE2 designs to the DE2-70…

  4. Thanks for this. This was a nice find after spending a few hours trying to port some DE2 designs to the DE2-70…

  5. I had a same warning with khalil.

    same warning: syntax error before numeric constant

  6. jwlangston21

    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);

  7. 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.

  8. 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

  9. Try set top entity for lights.vhd and recompile the whole thing.

  10. Great tutorial! Thank’s

  11. 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. :)

  12. Hi, I do think this is a great blog. I will revisit once again since i have saved as a favorite it.

  13. Interesting! I really admired you passion of posting thank you for this one. really happy to see your article

  14. The passion for writing articles is impressed and the way you presented it well. Thanks, and post furthermore articles.

  15. The passion for writing articles is impressed and the way you presented it well. Thanks, and post furthermore articles.

  16. 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.

  17. 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.

  18. Great website over here

  19. 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.

  20. 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.

  21. Great post. I like this post. Thanks for sharing this useful information.

  22. 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.

  23. 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.

  24. 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.

  25. Konferans koltuğu üretimi yapan firmamız, en kaliteli koltuk modelleri ile yanınızda yer alıyor.

  26. Thank you so much for this information.

  27. Thanks
    htttp://melekdenizi.com

  28. Hi
    Thank you for provide this wonderful list of problem and solution and waiting for more updates

  29. 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

  30. Everything is very open and very clear explanation for step by step keep moving, waiting for more updates, thank you for sharing with us.

  31. 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

  32. 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

  33. 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

  34. 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.

  35. 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

  36. اگر به دنبال ترجمه متون فارسی خود برای اهدافی مانند مدارک مهاجرت، ارسال مقاله به نشریات خارجی به دنبال مترجمانی کارکشته، با تسلط کامل بر زبان انگلیسی هستید تا متن شما به سرعت با بهترین کیفیت و نازل ترین قیمت به شما ارائه شود ترجمه آنلاین در خدمت شماست. ترجمه آنلاین با کادری از باسابقه ترین مترجمان و ارزان تر از همه جا ترجمه تخصصی فارسی به انگلیسی متون شما را انجام میدهد.

  37. Can you show me more of it? I am really interested in this. Would appreciate your kind response.

  38. 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

  39. 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.

  40. 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/

  41. 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.

Leave a Reply

Your email address will not be published.

© 2024 Jeremy W. Langston

Theme by Anders NorenUp ↑