Silicon Chip – April 2019

(Ben Green) #1

siliconchip.com.au Australia’s electronics magazine April 2019 37


Screen7: we would
never have guessed
these properties, so
we’re glad we found
a guide to help us
out. Make sure you
don’t select NVCM
programming. That
is the non-erasable
(write-once)
memory built into
the iCE40HX-1k IC.
We use the flash
memory instead,
to allow repeated
write/erase cycles.


vhdl” file from the SILICON CHIP web-
site, associated with this article, or
search based on the year and month of
publication. Copy this file to within the
project folder, then add it to the project
by right-clicking on “Add Synthesis
Files”. Select the file and then press
the “>>” button to add it to the project.
The “Run Synplify Pro Synthesis”
button is the first step in turning the
project into a bitstream. Double-click
this, and check that there are no er-
rors. We got an error message about
the license file, but it worked anyway.
Next click “Import P&R Input Files”.
You should see a pattern of working
through several steps along the left-
hand side of the project window, with
the green triangles turning into ticks
as the steps are completed by double-
clicking on them (see Screen5).
After the P&R (place and route) files
have been imported, the pins need to
be assigned. This is done with the Pin
Constraints Editor, selected from the
row of icons below the menus. In our
version, it is the fourth icon, which
looks like a blue square with pins com-
ing out of it.
The physical pin to I/O pin mapping
is shown in Table 1. LED1 and LED2
should be set to pins 95 and 96 (or
any of the other LED pins from the ta-
ble), and “clk” (the clock signal input)
should be set to pin 21. Save the project
to register the new pin assignments.
Finally, in turn, double click “Run
Placer”, “Run Router” and “Generate


Bitmap”. The generated bitmap is the
file that will be loaded onto the iCE-
stick. It can be found buried within
the project folder, eg, \BLINK_Im-
plmnt\sbt\outputs\bitmap\BLINK_
bitmap.bin

Diamond Programmer
Now we use the Diamond Program-
mer application to load the bitstream
onto the iCEstick. Open Diamond Pro-
grammer, select “Create a new blank
project” and click OK.
Under “Cable Settings” to the right,
click “Detect Cable”; the selected ca-
ble should include FTDI in its name.
We found we had to set the port to
FTUSB-1 (see Screen6).
In the main window, set the device
family to iCE40 and the device to iCE-
40HX1K. Under File Name, browse to
the bitmap file created by iCEcube2
and select it.
Click the “Device Properties” icon
(a chip with a small yellow pencil)
and set that as shown in the screen
grab (Screen7). Finally, click the “Pro-
gram” button to transfer the bitstream
to the iCEstick.
If all is well, your Output Window at
bottom left should look like our screen-
shot, and you should see two LEDs
flashing alternately on the iCEstick.

Conclusion
We devoted more space to describing
the iCEcube2 and Diamond Program-
mer software than IceStudio because

it requires more work to achieve the
same result.
We found that IceStudio was a real
pleasure to use and would highly rec-
ommend it to anyone who has not
worked with FPGAs before. We found
a couple of small glitches, including
occasional crashes even on quite small
projects. So save your work often.
We also found IceStudio became
quite sluggish on larger projects, taking
some time to zoom and move around.
We imagine that as we become more
proficient with Verilog, that our IceS-
tudio projects will consist of nothing
more than a single large code block,
which should not present the same
performance issues as lots of smaller
blocks.
IceStudio also appears to have the
benefit of being written specifically
for development boards such as the
iCEstick.
If you are a professional developer,
especially someone looking to build
an FPGA into an end product, the flex-
ibility and complexity of iCEcube2 will
be warranted. Just choosing a different
flash IC to that fitted or another small
hardware change different to the iCEs-
tick would probably be enough to ham-
per IceStudio in these cases.
With iCEcube2, once we had our
project set up, everything worked quite
well; similarly, Diamond Programmer
worked quite well, although the time
spent pulling hair and debugging cryp-
tic error messages was quite a bit more
than we had hoped.
But for someone who has not worked
with FPGAs before, IceStudio will give
a smooth, easy way for you to become
accustomed to what is possible.
In terms of hardware, there are a few
development boards around which
feature more powerful FPGAs than
the iCEstick.
But for now, the iCEstick suits our
purposes, and we think it will be a great
starting point for those wishing to try
out FPGAs for the first time.
The iCEstick is available from Mous-
er and Digikey; both offer free interna-
tional express delivery for orders over
AUD $60.
The iCEstick is around $30-40, so
you could order two and get free deliv-
ery, or order one and something else.
Use the following links:

siliconchip.com.au/link/aao1
or
siliconchip.com.au/link/aao2 SC
Free download pdf