Skip to content

Arduino Library for programming MachXO2/XO3 devices

License

Notifications You must be signed in to change notification settings

fpgs/MachXO_Library

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lattice MachXO Arduino Library

This is an Arduino driver library for accessing the configuration port of the Lattice MachXO2/MachXO3 through I2C or SPI. This implements the procedures outlined in the Programming and Configuration Usage Guides: MachXO2 Programming and Configuration Usage Guide MachXO3 Programming and Configuration Usage Guide

About this Driver

To access the Lattice MachXO device, you only need the standard Wire(I2C) or SPI libraries. However, the size of the images for the MachXO devices are larger than the integrated storage of some microcontrollers so the load function reads the data from a file using the SdFat library.

To use this library, copy this directory and all the contents into the "libraries" directory where Arduino keeps all your installed libraries (typically ~/Documents/Aduino/libraries).

MachXO2/3 Hex Files

To manage file size and for ease of parsing, the load function uses the hex file format. The .jed Jedec files can be translated into .hex format using the Lattice Diamond Deployment Tool.

Examples

Examples are provided that demonstrate how to load a hex file into the MachXO device. These examples get the file from an external flash device as is available on the Adafruit "Express" boards like the Feather M4 Express or Feather nRF52840 Express. This configuration is becoming very popular since the extra storage makes it easier to implement CircuitPython. For boards without SPI flash, an SD card can be used to store the files. The TinyUSB libray is used so that files can be copied to the board just like a USB thumb drive.

machXOdemo

This demonstration can be used with I2C or SPI. Select the interface you wish to use by which of lines 69-71 is not commented out. A simple terminal interface is provided to test the different commands.

i2c_term

This is similar to machXOdemo, except that it includes generic I2C commands in the terminal interface so that it can also be used for interfacing with your own user code running on the FPGA, or with other I2C devices on the same bus.

Example Hex Files

Some example hex files are provided in the examples/hex_files folder for demonstration purposes.

  • tiny256.hex is an example for the TinyFPGA AX1 that blinks the LED
  • xo3starter.hex is an example for the MachXO3LF Starter Kit that applies a counter to the LEDs controlled by the switches

About

Arduino Library for programming MachXO2/XO3 devices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%