New Command Set

A project log for TinyFPGA Programmer

A dirt cheap open hardware USB-JTAG board designed to program TinyFPGA A1 and A2 boards.

Luke ValentyLuke Valenty 09/04/2017 at 21:320 Comments

In the last log I wrote about how much faster the new firmware and Python library is.  Now I want to talk a little bit about the new commands that enable this performance improvement.

TinyFPGA Programmer Firmware Command EncodingTinyFPGA Programmer Firmware Command Encoding

There were three original commands for driving the programmer: CONFIG_IO, SET, SET_GET.  These commands allow you to configure individual GPIO pins for INPUT or OUTPUT, set pin values, and get pin values.  They are enough to bit-bang slow enough protocols, but not very fast.  

To enable the faster speeds in the latest firmware, six new commands were added:


This shifts many bytes of data at a time serially through the GPIO pins.  The shift operation is highly configurable: it can output data, input data, check data with a mask, and even  consume or produce no data at all if configured to do so.  The firmware supports a total of 8 programmable SHIFT configurations that allow many aspects of the SHIFT command to be configured.


SIE stands for Serial Interface Engine.  CONFIG_SIE allows you to program each of the 8 serial interface engine configurations.  When a SHIFT command is sent, it specifies the index of the SIE configuration to use.


A total of 60 bytes worth of commands can be repeated up to (2^16 - 1) times or until a SHIFT check data operation within the loop matches.  This capability is used for JTAG programming to poll the FPGA's busy status bit while waiting for a flash erase or write operation to complete.  Loops must be terminated with an END_LOOP command.  If the loop terminates before a successful match, a failure status code will be sent to the host computer.


Results of SHIFT with check data, and LOOPs are only returned if there is a failure, and only if a failure has not previously been reported.  Before a bitstream is programmed to a TinyFPGA board, the CLEAR_STATUS command is sent.  At the very end of the entire programming procedure, the GET_STATUS command is sent.  If there is an error, the error status will be sent at the time the error occurred as well as when the GET_STATUS command is executed.  If there is no error, then a successful status will be sent when the GET_STATUS command is executed.