is an Arduino
UNO compatible board based on the iCE40HX4K-TQ144 FPGA
Lattuino is similar to Arduino UNO, but implemented using an FPGA board. For this reason Lattuino doesn't use a hardware CPU, it uses a soft-core instead.
Its name comes from the union of Lattice and Arduino, so Lattuino is an Arduino implemented using a Lattice FPGA, with roots in Latin America.
Its initial implementation is part of the Kéfir project. The Kéfir I board was designed with this objective in mind.
In this way a Kéfir I board can be used to develope using FPGA and/or Arduino workflows, making it a very versatile education tool.
In the following picture you can see an Adafruit 1651 shield (TFT screen and touchscreen) connected to a Kéfir I board. The software running in the board is one of the Adafruit's demos, you can draw using the touchscreen.
The FPGA used in Kéfir I is a Lattice iCE40HX4K-TQ144 (3520 LUT4s, FFs and carry; 2 PLLs; 80 kib SRAM; 107 GPIOs). This is an economic FPGA, but with some important restrictions. One of its problems is the small ammount of embedded memory, limiting the Arduino's available memory.
- Program memory: 7536 bytes (8192 total memory less 656 used for the bootloader, comparable
to Arduino boards based on the ATmega8)
- Datat memory: 512 bytes
- Clock frequency: 24 MHz (similar performance of an Arduino at 16 MHz)
- Digital input/output: 15 (14 general + 1 LED)
- Analog inputs: 8 (2 more than UNO)
- Analog outputs (PWMs): 6
- UARTs: 1
- SPIs: 1 (upto 24 MHz SCK)
- Independent timer for tone generation: 1
- Interrupt inputs: 2
- FPGA usage: 56 a 66%
- I/O voltage: 3,3 V
How can I program it?:
Like other Arduino boards you can use sketch an the Arduino's IDE.
You just need to add the Lattuino support to the IDE. We tested it using version 1.8.1. The first step is to indicate where is the board description for Lattuino. In the File menu choose the Preferences option. This will open a new dialog. In the Additional Boards Manager URLs enter http://fpgalibre.sf.net/Lattuino/package_lattuino_index.json. After configuring it go to the Tools menu, option Board, and select Boards Manager. This will show you a list of boards with support for the IDE. Now look for the Lattuino support (at the end of the list) and click on the More info link. This will enable the Install button. After installing the support you'll be able to choose Lattuino from the Tools/Board menu.
All the standard Arduino API is supported. In addition the SPI and SoftwareSerial are also available.
The rest of the workflow is similar to what you do with an Arduino UNO.
Which synthesis tools are needed?:
The current Lattuino implementation is in VHDL. The synthesis tool for iCE40 FPGAs is iCEcube2.
You'll also need some UNIX common tools, like the make command.
The core can be manually configured, editing a VHDL file, or using a graphical tool like the one used to configure the Linux kernel. To run this configuration tool you'll need the TCL/Tk and Perl interpreters.
If you want to introduce changes in the code you'll need some additional tools. The gcc compiler is needed to compile some utilities. Additionally, you'll need to install various FPGA Libre tools. In Debian GNU/Linux compatible systems you can just install the lattuino-tools package from our repository.
Debian GNU/Linux example:
root@debian# curl -sSL http://fpgalibre.sf.net/debian/go | sh
root@debian# apt-get install lattuino-tools
usuario@ubuntu$ curl -sSL http://fpgalibre.sf.net/debian/go | sudo sh
usuario@ubuntu$ sudo apt-get install lattuino-tools
How do I run the synthesis?:
To obtain the Lattuino code we recommend cloning the FPGA Libre repo on GitHub:
git clone https://github.com/FPGALibre/fpgacores.git
Then you must edit the fpgacores/synth_lattuino_1.sh script to ajust the
XIL_TOOLS_ICE_DIR variable, so it points to your iCEcube2 installation.
After it you just run the above mentioned script.
Allowed I/O levels:
Is very important to understand that the I/O pins use 3.3 V and aren't 5 V tolerant.
We left the pins protection outside the board, because the king and degree of protection depends on the use. If you plan to use the board in a hostile environment we recommend using a 3.3 V Arduino shield including suitable protections. The design of such a shield is very simple.
Lattuino is an open hardware project. The VHDL code is covered by the GPL v2.0 licence or newer and the Arduino API is covered by the LGPL v2.1 licence or newer.
The following papers are related to Lattuino:
For general questions tou can use the MILK's mailing list.
For specific questions you can contact Salvador E. Tropea.