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

No comments: