Blog Post

Blog
3 MIN READ

Teaching FPGAs and Microcontrollers to Share

yuki's avatar
yuki
Icon for New Contributor rankNew Contributor
25 days ago
Using FPGAs and MCUs Collaboratively

FPGAs and microcontrollers can be used alternatively in some applications, but they can also be used cooperatively.  FPGAs provide ultimate flexibility, but microcontrollers often include peripherals like USB or wireless interfaces that may be more convenient for communications and updates.  Both devices require supporting circuitry such as power, reference clocks, and storage.  Fortunately, these can often be shared when using FPGAs and microcontrollers together. This blog introduces an open-source tool that enables microcontrollers to load a programming file into a programmable device, and the practical application of this with the Raspberry Pi RP2350 MCU. 

An Open Standard for Loading Programmable Devices

Loading programmable devices from embedded processors is a common task.  The Jam Standard Test and Programming Language (STAPL) was originally developed by Altera engineers to address challenges in programming programmable logic devices (PLDs) in-system, such as proprietary file formats, vendor-specific algorithms, large file sizes, and long programming times. It provides a software-level standard for in-system programming (ISP), enabling flexibility and platform independence.

Figure 1. In-system programming using the Jam File & Jam Player via an embedded processor. 

In August 1999, JAM/STAPL was adopted as JEDEC standard JESD-71, making it an industry-recognized solution for JTAG-based programming. The language introduced features like compact file formats, branching, and looping, which reduced programming time and file size—ideal for embedded systems. JAM/STAPL consists of two main components: 

  1. Jam Composer: Generates Jam Files (.jam) containing programming algorithms and user data. 
  2. Jam Player: Interprets these files and applies JTAG vectors for programming and testing devices. 

Over time, JAM/STAPL gained widespread support from PLD vendors, programming equipment makers, and test equipment manufacturers, becoming a cornerstone for in-field upgrades, prototyping, and production programming. Its evolution also included a byte-code format (.jbc) for even smaller files, making it suitable for resource-constrained embedded processors.

Recently, Altera updated the license terms of the JAM and JBC players source code to MIT-0, to better clarify the usage rights. 

A Practical Example

The CycloMod board is an example of an FPGA and microcontroller working cooperatively.  The board combines a Raspberry Pi RP2350 MCU with a Cyclone® 10 LP FPGA in the SparkFun MicroMod form factor.  In this board, the FPGA is connected to some of the edge connector I/O, while the RP2350 is used to provide a flexible USB interface. The boot ROM in the RP2350 is leveraged extensively for firmware and FPGA image updates.

Figure 2. CycloMod Board

At 22mm x 22mm (including the card-edge connector), the MicroMod form factor is quite compact. This necessitates sharing resources, as there is not much room for multiple oscillators or flash devices.  The 12 MHz crystal oscillator in the RP2350 is easily shared by routing it to one of the GPIO clock outputs.  Both the Cyclone 10 LP device and RP2350 rely on external storage, but this can also be shared.  On this board, the flash is connected to the RP2350 to take advantage of the UF2 loading provided in the boot ROM, and the RP2350 loads the Cyclone FPGA.  The Cyclone 10 LP device supports active configuration with an external SPI flash device, but it can also be configured/programmed passively through JTAG.

Figure 3. CycloMod Block Diagram 

The STAPL byte code format (sometimes referred to as JBC) is compact enough to be used with microcontrollers like the RP2350.  Altera provides source code for implementing the “players” to process these files in embedded systems.  They offer players for the ASCII (JAM) and bytecode (JBC) versions of the files.  

Altera’s Quartus® software provides the option to generate JAM and JBC files.  Since STAPL is a JEDEC standard, other FPGA vendors also support generating these files.

Using the open-source code provided by Altera, the RP2350 is able to read a JBC file from flash and load the Cyclone 10 LP FPGA through the JTAG interface.  A Python script is provided to convert the JBC files to the UF2 format, which the RP2350 uses for drag-n-drop programming.  The script also adds a header with the file length and other details.  Thanks to the ingenuity of the UF2 format created by Microsoft, this enables cross platform field updates with zero software to install. 

Results and Link to Source

Porting Altera’s JBC player to the RP2350 eliminated the need for a second flash device and enabled user-friendly drag-n-drop FPGA updates.  The port is available on GitHub if you want to use this in your system. 

https://github.com/steieio/pico-jbc  

Updated 25 days ago
Version 1.0
No CommentsBe the first to comment