Silicon Chip – April 2019

(Ben Green) #1

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


The driver switcher uses the Zadig
driver utility. IceStudio gives you some
prompts which explain how to use Za-
dig, then opens the program, allows you
to make the changes, and then prompts
you to unplug and replug the iCEstick.
This is all fairly seamless, and it’s
comforting that the program is up-front
about what changes you are making.
The Zadig utility also has the option
of changing other drivers, so great care
should be taken that you don’t inad-
vertently change the wrong driver.
We also noticed that, very occasion-
ally, Windows would reload the old
driver (perhaps when the iCEstick was
plugged into a different USB port). In
that case, it is merely necessary to re-
run the driver switcher routine.


Setup


Once the installer has finished, start
IceStudio. You will be prompted to
install the toolchain, which requires
the Python scripting language to be in-
stalled, plus a few other packages. If
you are not prompted, check the Tools
→ Toolchain menu, and click Update if
you are unsure. We found that this pro-
ceeded without any problems, though
you need internet access to download
these extra packages.
You will then be prompted to up-


date the drivers. This is only possible
if you have an iCEstick connected. If
you don’t have an iCEstick, skip this
step. Again, there is no harm in check-
ing the drivers if you are not prompted.
Now click Tools → Drivers → Ena-
ble. IceStudio will indicate a few steps
that will occur. Click OK to proceed.
Note the message about using USB 2.0
ports. We ran into problems using the
iCEstick on a USB 3.0 port, but were
able to use a USB 2.0 hub to ‘down-
grade’ our connection to USB 2.0 and
it worked after that.
When the Zadig Driver Utility opens
(Windows may ask for permission for
the program to make changes), take
great care to change the correct driv-
ers. Zadig has facilities for many driv-
ers, but we only want to change those
for the iCEstick.
Ensure that “Lattice FTUSB Inter-
face Cable (Interface 0)” is selected in
the dropdown and check that the item
to the right of the green arrow is “libus-
bK” (in our case, version 3.0.7.0), then
click “replace driver” (see Screen1).
IceStudio will now prompt you to
unplug and replug the iCEstick. Do
this to ensure the drivers are loaded
correctly.
The final step is to select the devel-
opment board. This is done from the

Select → Board menu; the iCEstick is
found under the HX1K subheading.
Selecting the correct board means that
friendly names are available for the
various I/O pins. For example, a pin
named “D1” can be selected, which
maps directly to LED1 on the iCEstick.
This completes the setup. There are
examples available under the File →
Examples menu. Many of these appear
to be written for other boards, but are
simple enough to adapt for the iCEs-
tick. The only real differences appear
to be the I/O pin mappings, which are
blanked on conversion.
We also suggest enabling the FPGA
resources view, by clicking View →
FPGA resources, and ensuring this
item is ticked. The bottom bar of the
window will now show the resource
usage, which is empty at this stage.
This will let you keep track of how
‘full’ your FPGA is.

Using IceStudio
A good place to start is the example
available under the following menu:
File → Examples → Basic → Two LEDs
alternate blink.
Upon opening this, you will be
prompted that it is designed for a dif-
ferent board; simply click “convert”.
As mentioned above, conversion in-
volves removing any I/O pins associ-
ated with the old board. To complete
the conversion, click on the LED drop-
down boxes, and select D1 and D2 (see
Screen2).
The next step is to compile the pro-
ject into a bitstream. Click Tools →
Build or press Ctrl-B. After a few sec-
onds, a message will pop up which
should say “Build done”. Finally,
click Tools → Upload to send it to the
iCEstick. The LEDs will all light up
dimly during the upload stage, and
if the upload is successful, two of the
LEDs should be alternately flashing.
If you have trouble with the up-
load, check the drivers using the En-
able Driver option or try a different
USB port.
We recommend looking at the exam-
ples to see what can be done with IceS-
tudio. The four menu items at top right
are various items that can be dropped
into the editor to create your project.
Included in these (under Basic) is
a “Code” option. This allows blocks
containing Verilog code to be includ-
ed. For those familiar with Verilog,
the blocks are effectively the same as
Verilog modules. Such a code block

Screen4: this screen grab
shows the iCEcube2 new
project settings to suit
the iCEstick. The project
name and location
can be set to suit your
system, but the device
properties are critical
for correct operation.

Free download pdf