{"product_id":"fpga-development-board-with-usb-blaster-in-pakistan","title":"Fpga Development Board With Usb Blaster","description":"\u003cul\u003e\n\u003cli\u003eAltera Cyclone IV EP4CE6E22C8 FPGA chip with 6272 logic elements, 270 Kbits of memory\u003c\/li\u003e\n\u003cli\u003e8-digit seven-segment LCD display\u003c\/li\u003e\n\u003cli\u003e8 position DIP switch\u003c\/li\u003e\n\u003cli\u003eVGA output\u003c\/li\u003e\n\u003cli\u003ePS\/2 input port (comes in handy to try out keyboard processing)\u003c\/li\u003e\n\u003cli\u003ebuzzer\u003c\/li\u003e\n\u003cli\u003ea couple of push buttons\u003c\/li\u003e\n\u003cli\u003ea handful of IO pins, some of which can be used as a connector for a 1602\/12864 display and 22 miscellaneous pins\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003ch2 id=\"software-installation\"\u003eSoftware installation\u003c\/h2\u003e\n\u003cp\u003eI have registered on Intel download center and downloaded and installed\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/fpgasoftware.intel.com\/20.1\/?edition=lite\u0026amp;platform=windows\"\u003eQuartus 20.1 Prime Lite\u003c\/a\u003e\u003cspan\u003e \u003c\/span\u003ealong with ModelSim and Cyclone IV device support.\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"\/products\/fpga-development-board-with-usb-blaster-in-pakistan\" alt=\"1602 display\"\u003e\u003cspan\u003e \u003c\/span\u003e\u003cem\u003eQuartus 20.1 with some Verilog code in it\u003c\/em\u003e\u003c\/p\u003e\n\u003cp\u003eI’ve also downloaded a support package specific to this board from an\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/www.aliexpress.us\/item\/2251832627421359.html?gatewayAdapt=glo2usa4itemAdapt\u0026amp;_randl_shipto=US\" title=\"Aliexpress seller’s page\"\u003eAliExpress seller’s page\u003c\/a\u003e\u003cspan\u003e \u003c\/span\u003ethat’s selling the same device. It’s also a good idea to archive such pages and the software packages as they’re likely to disappear forever one day. The documentation consists mostly of huge Word documents with photos, it doesn’t look very professional, but it’s better than nothing.\u003c\/p\u003e\n\u003cp\u003eThe package from seller also contains several sample\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003e.sof\u003c\/code\u003e\u003cspan\u003e \u003c\/span\u003e(SRAM Object File) files, which is a binary format used by the board programmer. I wanted to load them on the device, one needs to use Quartus Prime Programmer to do that, with the USB blaster connected between the computer and the board. The board obviously needs to be powered on by a separate micro USB cable.\u003c\/p\u003e\n\u003ch2 id=\"driver-installation\"\u003eDriver installation\u003c\/h2\u003e\n\u003cp\u003eAfter installing the drivers the blaster shows up as “Altera USB-Blaster” on my computer. That’s nice, but the Quartus Programmer doesn’t see the USB blaster in the devices list. I wasn’t able to get this working on Windows 10 at all, so I tried installing the same under Linux (Ubuntu 20) and there the USB Blaster installed almost on its own. The programmer was still complaining about a broken JTAG chain, which can be confirmed by a command line tool\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003ejtagconfig -d\u003c\/code\u003e\u003cspan\u003e \u003c\/span\u003e- found in the Quartus\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003ebin\u003c\/code\u003e\u003cspan\u003e \u003c\/span\u003edirectory. Following advice online, I had to link a different version of the\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003elibudev\u003c\/code\u003e\u003cspan\u003e \u003c\/span\u003elibrary with\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003eln -s \/lib64\/libudev.so.1 to \/lib64\/libudev.so.0\u003c\/code\u003e\u003c\/p\u003e\n\u003ch2 id=\"testing-bitstreams\"\u003eTesting bitstreams\u003c\/h2\u003e\n\u003cp\u003eAfter that I was able to upload the testing\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003e.sof\u003c\/code\u003e\u003cspan\u003e \u003c\/span\u003efiles to the board and was greeted by blinking lights - so yes, it works. As opposed to my\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/jborza.com\/hardware\/2020\/08\/02\/hardware-adventures-2-fpga.html\"\u003eElbert V2 Xilinx dev board\u003c\/a\u003e, uploading the configuration to the FPGA chip and the on-board flash chip are two distinct operations, so I’m yet to find a way on how to make my changes persist through the Altera board being powered off.\u003c\/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eNote: The FPGA boards usually contain a flash chip to store the configuration for the chip that loads from this flash memory on powerup. During development, one can reconfigure the FPGA chip’s SRAM through the JTAG interface, bypassing a need to rewrite the flash memory and power cycle the board.\u003c\/p\u003e\n\u003c\/blockquote\u003e\n\u003cp\u003eThis can be done using File-\u0026gt;Convert Programming File, selecting the input\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003e.sof\u003c\/code\u003e\u003cspan\u003e \u003c\/span\u003efile and producing an output\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003e.jic\u003c\/code\u003e\u003cspan\u003e \u003c\/span\u003efile, which can then be uploaded to the flash using the Programmer tool.\u003c\/p\u003e\n\u003ch2 id=\"blinking-some-leds-on-my-own\"\u003eBlinking some LEDs on my own\u003c\/h2\u003e\n\u003cblockquote\u003e\n\u003cp\u003eI’m sure I’ll read this section in the future when trying to figure out how to program this board.\u003c\/p\u003e\n\u003c\/blockquote\u003e\n\u003ch3 id=\"creating-a-new-project-in-quartus\"\u003eCreating a new project in Quartus.\u003c\/h3\u003e\n\u003cp\u003eI had to specify the EP4CE6E22C8 chip. I also have to find a way to add a pin assignment file (recycling one from the Chinese archive by using Assignments-\u0026gt;Import Assignments).\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"\/products\/fpga-development-board-with-usb-blaster-in-pakistan\" alt=\"pin assignment\"\u003e\u003cspan\u003e \u003c\/span\u003e\u003cem\u003ePin assignment in Quartus assignment editor\u003c\/em\u003e\u003c\/p\u003e\n\u003cp\u003eLuckily, the board is annotated with pin locations corresponding to IOs such as LEDs, clock and other pins.\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"\/products\/fpga-development-board-with-usb-blaster-in-pakistan\" alt=\"pin assignment\"\u003e\u003cspan\u003e \u003c\/span\u003e\u003cem\u003ePin annotations on the board\u003c\/em\u003e\u003c\/p\u003e\n\u003cp\u003eWith the LED and clock assignments completed, I was able to write a simple “Hello World” spinning LED code.\u003c\/p\u003e\n\u003cp\u003eTo produce the output bitstream, we can compile the project with the “Start compilation” button, and program the board using the Programmer tool (exactly the same as programming the pre-made\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003e.sof\u003c\/code\u003e\u003cspan\u003e \u003c\/span\u003efiles previously).\u003c\/p\u003e\n\u003ch2 id=\"other-peripherals\"\u003eOther peripherals\u003c\/h2\u003e\n\u003ch3 id=\"displays\"\u003eDisplays\u003c\/h3\u003e\n\u003cp\u003eI was able to connect the 1602 and 12864 displays and test them with the bitstreams provided by the vendor. The board provides a jumper to to switch between 3.3V and 5V voltages, which is cool, as 5V displays were cheaper and easier to find in my location. There’s also a knob to adjust the contrast of the connected screen.\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"\/products\/fpga-development-board-with-usb-blaster-in-pakistan\" alt=\"1602 display\"\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cem\u003eThe display connected to the board. Apologies for my wonky soldering job, I really don’t like that activity.\u003c\/em\u003e\u003c\/p\u003e\n\u003cp\u003eHere’s the\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/gist.github.com\/jborza\/1831f69983af6ec0e48bbf32ce7229e2\" title=\"Lcd1602.vhd · github\"\u003esample VHDL code\u003c\/a\u003e\u003cspan\u003e \u003c\/span\u003efor the 1602 display.\u003c\/p\u003e\n\u003cp\u003eThe 12864 display kind of surprised me, as it’s gigantic - 3.2 inches - compared to the more modestly sized OLED screens I have been using with Arduino and ESP32 boards.\u003c\/p\u003e\n\u003cp\u003eRefactoring the sample code was fun, I used the\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/www.exploreembedded.com\/wiki\/images\/7\/77\/QC12864B.pdf\" title=\"Datasheet\"\u003edatasheet\u003c\/a\u003e\u003cspan\u003e \u003c\/span\u003eto figure out what the hex codes actually meant and I also learnt some more Verilog.\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/github.com\/jborza\/altera-12864-demo\/blob\/main\/LCD12864.v\" title=\"Altera-12864-demo\/lcd12864.v at main · jborza\/altera-12864-demo · github\"\u003eHere’s the modified sample code\u003c\/a\u003e\u003cspan\u003e \u003c\/span\u003efor the 12864 display in the text mode.\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"\/products\/fpga-development-board-with-usb-blaster-in-pakistan\" alt=\"12864 display\"\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cem\u003eThis LCD screen is just huge.\u003c\/em\u003e\u003c\/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eNote: I had to adjust the pin type for\u003cspan\u003e \u003c\/span\u003e\u003cem\u003enCEO: Use as regular I\/O\u003c\/em\u003e\u003cspan\u003e \u003c\/span\u003ein Quartus as the pin was colliding with the LCD data 0 pin (P101) - you can set this in Device and Pin options or in the .qsf file as\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003eset_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION \"USE AS REGULAR IO\"\u003c\/code\u003e\u003c\/p\u003e\n\u003c\/blockquote\u003e\n\u003ch3 id=\"buzzer\"\u003eBuzzer\u003c\/h3\u003e\n\u003cp\u003eUsing the fpga4fun.com\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/www.fpga4fun.com\/MusicBox1.html\" title=\"Fpga4fun.com - music box 1 - simple beep\"\u003eMusic box tutorial\u003c\/a\u003e\u003cspan\u003e \u003c\/span\u003ewas a fun way to try out the buzzer. It sounds a bit screechy, it could be a fun project to combine it with other inputs, for example the keyboard.\u003c\/p\u003e\n\u003ch3 id=\"ps2-keyboard\"\u003ePS\/2 Keyboard\u003c\/h3\u003e\n\u003cp\u003eAlthough I had to buy a cheap PS\/2 keyboard to test out this port, a sample VHDL file to display the scan code on the display showed weird output. The mapping to the display segments was incorrect in the sample file, so I fixed it and was able to see the scan code on the display:\u003cspan\u003e \u003c\/span\u003e\u003ccode class=\"highlighter-rouge\"\u003e29\u003c\/code\u003e\u003cspan\u003e \u003c\/span\u003eis generated by the space bar.\u003c\/p\u003e\n\u003cp\u003eCode of this PS\/2 demo\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/github.com\/jborza\/altera-c4-ps2demo\/blob\/main\/keyboard_test.vhd\" title=\"Altera-c4-ps2demo\/keyboard_test.vhd at main · jborza\/altera-c4-ps2demo · github\"\u003eis available on GitHub\u003c\/a\u003e, there’s also a much nicer VHDL version available on\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/forum.digikey.com\/t\/ps-2-keyboard-interface-vhdl\/12614\" title=\"Digikey eewiki\"\u003edigikey eewiki\u003c\/a\u003e.\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"\/products\/fpga-development-board-with-usb-blaster-in-pakistan\" alt=\"a keyboard connected to the board\"\u003e\u003c\/p\u003e\n\u003ch2 id=\"a-fun-future-project\"\u003eA fun future project\u003c\/h2\u003e\n\u003cp\u003eThis does look like a fun board to implement a toy CPU on. There’s some block RAM available, a variety of IOs to be memory mapped (serial port, PS\/2 input, buzzer, text buffer or diagnostics via the LCD screen and VGA out). With 6k logic elements a modestly sized 6502 or RISC-V core should fit alongside drivers for at least some of the peripherals.\u003c\/p\u003e\n\u003c!----\u003e","brand":"Digilog Electronics","offers":[{"title":"Default Title","offer_id":43962429276225,"sku":"b70,D,161,IMP5,Th2","price":7500.0,"currency_code":"PKR","in_stock":false}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0727\/2805\/1777\/files\/FPGADevelopmentBoardInPakistan.jpg?v=1779577202","url":"https:\/\/stem.pk\/products\/fpga-development-board-with-usb-blaster-in-pakistan","provider":"stem.pk","version":"1.0","type":"link"}