Showing posts with label Cyclone ii. Show all posts
Showing posts with label Cyclone ii. Show all posts

Wednesday, March 11, 2020

FPGA First steps -2- (General procedure & Resetting the screen)

As mentioned in my previous blog post i started experimenting with a Cyclone ii FPGA. There are several steps involved. It can look complicated. Therefore before diving into details i will explain the big picture in this blogpost.

  •  Install the software
  •  Create the FPGA logic
  •  Connect inputs and outputs to physical ports (Pin Planner)
  •  Compiling the created logic
  •  Upload the project to the FPGA  (Program) 
  •  Test the project in the FPGA

Install Software:
To use my Cyclone ii FPGA
i installed Quartus ii  version 13.1 software on my computer (Windows 10)
and the USB blaster software
Quartus is a big program so downloading and installing will take a long time. It is more a interface connecting different parts for managing the FPGA. As it are different modules sometimes saving before switching to another module is needed.

Create the FPGA logic
To create the FPGA logic there are several options in the Quartus ii package e.g.
Graphical interface
VHDL
Verilog
As the graphical interface looks intuitive and i found a YouTube instruction about it. Therefore i started my first experiments with this.

Connect inputs and outputs to physical ports (Pin Planner)
To connect the logical inputs and outputs a part in Quartus named Pin Planner can be used.
Before this can be done the logical inputs and outputs needs to be present. These logical ports can be created easy by compiling the design. This first compilation will not output something that will work as at that moment the physical outputs are not included in the compilation.
However it will prepare the logical ports for the Pin Planner. In the Pin Planner these ports can be manual assigned to to physical ports.
After the assignment of the physical ports another compilation needs to be done to include information about the physical ports.

Compiling the created logic
Compiling is relative simple and can be started different ways:
Using the menu 
Processing - Start Compilation
Ctrl+L
The button with a triangle
The compilation can give Errors when the compilation was not successful. Otherwise there can (and will) be Warnings. 

Upload the project to the FPGA  (Program) 
To upload the result to the FPGA ("Programming") there are two options
Store it temporary 
Store it permanent
When storing it permanent it can be overwritten later by storing something else. The difference is that the settings are erased after powering the system down when storing it temporary. 

Test the project in the FPGA
Details how to test depends on the created logic.
It is also possible to test the created FPGA logic before uploading using a simulator.
This simulator requires some configuration.

Help
An important file with links to the software Handbook and other resources is can be found in Quartus ii under
  Help
     Readme File

During testing it you can easy change the displayed screen in Quartus II
It is possible to reset the windows to the setting during installation without repeating the installation process.
See https://www.intel.com/content/www/us/en/programmable/support/support-resources/knowledge-base/solutions/rd07092001_1535.html for two options to do this:

Using a menu option in the Quartus II Graphical User Interface (GUI):
Choose Tools and then select Toolbars.
Click the Toolbars tab.
Click Reset All.
Click OK.

Using a Windows Command (DOS) Prompt:
Close the Quartus II software.
Open a Windows command prompt or DOS window (Start -> Programs -> Command Prompt).
At a command prompt, change directory (using the cd command) to the Quartus installation directory/bin.
Type the following: quartus -reset_desktop

During my experiments/testing/learning i needed to use the second option (using the Windows Command prompt as i did not find another way to get the screen back in a reasonable status.

Thursday, February 6, 2020

FPGA first steps -1-

My last blog post was more than a month ago. However this does not mean that i did not projects or learned new things. For a long time i wanted to do something with FPGAs but never found a good way to start.
Recently i did some research how to start with board below 22 euro from AliExpress. I found some boards. e.g. the EP2C5T144 and EP4CE6E22C8N Altera FPGA Cyclone ii and iv development boards. These boards also need an USB blaster (that only a cost a few euros). They are not the newest boards but offer a cheap way to start.

Sooner than expected i received EP2C5T144 Altera Cyclone ii development board from China. This blog post is a short introduction also to log results of some of my experiments until now.
The Cylone ii is an older FPGA that is not supported anymore in the newest software only Quartus II version 13.1 (servicepack p1 version 13) or lower can be used. There is a free version of the software. Registration for download is required. The software can be a bit confusing as it has many options. The free version is sufficient to use the FPGA. Some options only work in the payed version.
There are warning not to use directory or file names with spaces.
The development board came together with an USB blaster. The 4 Dupont connectors 2*14 pin where not yet soldered.
On circuit diagram i found for this board is an IS61LV25616-10T memory chip. As mentioned in the text in the article i found this is more the explanation how to connect the chip as it is not on the development board. Perhaps if i ever make an expansion board ( JLCPB ) for this FPGA i will add this to the board as these chips are still available.
The board has two connection points for the USB blaster:
JTAG one close to the 2*14 pins for temporary programming using an *.sof file.
AS close to the edge of the PCB for more permanent programming using a *.pof file.
The board has a power led and 3 leds connected to the FPGA
Led D2 = PIN_3
Led D4 = PIN_7
Led D5 = PIN_9
For input there is one push button "key" connected to PIN144
Soon i discovered the FPGA is not powered over the USB blaster and needs a separate 5V power source. Fortunately i could temporary cannibalize a 5V power adapter with the right connection while waiting for a power adapter from China.
Replicating and adapting some simple experimenting with this FPGA i also discovered a little issue. Perhaps i do not configure the i/o the right way. Touching the push button with my finger (without really pushing) also had effect on the leds. I only could work reliable with the logic when using a pen or some other con conduction material to push the button This issue was not reported in the articles i read.
The one input pin also limits the possibilities for experiments so i decided to solder the Dupont pins. As i was soldering i also did put a 2 pin Dupont connector on P8 to easy access to the 5V power. I could resist my temptation to solder (more Arduino style) female in stead of male 2*14 pins. So i am still compatible with other FPGA owners.
This way it was easy to connect more buttons. Also input is more comfortable without issue when touching the button. I found a YouTube video with information where 5 buttons wired to pin 40 - 44 and the other side the button connected to ground. This is not explained in the video, however the next FPGA video of this YouTuber is explained that this connection to ground will give inverse logic (1 is default 0 = pushing the button). I did not repeated his experiment but used this configuration with graphical creating some logic in the Quartis ii. It did not work and i also could not find the setting for internally configuring a resistor for the input pin. Finally i changed the button connection from ground and connected it to VCC (3V3 pin 28 on P2). After this change my circuits did work.
However the leds also dimmed when i touched a ground connection with my hand. Even some times the leds reacted when moving my hand near the wires, especial when leds where not included in a circuit.
In an next blog post i will try to explain in more detail how to start using this interesting FPGA the software to create a project.
Summary:
It is possible to start cheap with FPGA using an EP2C5T144
You also need a USB blaster and a 5V power supply and perhaps a soldering iron if headers are not soldered yet.
Use the free software Quartus II version 13.1 (or below) as the higher versions do not support the Cyclone ii anymore. Do not use space character.
It is nice to also have some buttons and Dupont wires as this board only has one push button for input.