Pico-ice Microcontroller Development Board with FPGA and MicroPython

Pico-ice Microcontroller Development Board with FPGA and MicroPython

Pico-ice Microcontroller Development Board with FPGA Now Supports MicroPython

This is a guest post by Camille B.

Maybe you have heard of it, maybe you have not, tinyVision.ai’s Pico-ice and its successor, Pico2-ice, are compact microcontroller development boards. These boards have an affordable envelope and feature:

·         Raspberry Pi RP2 microcontroller

·         Lattice iCE40UP5K FPGA  

The unique combination of Raspberry Pi microcontroller and the Lattice FPGA has enabled providing a MicroPython firmware that makes using the board easy for everyone.

Pico-ice is also an open-source hardware. Please refer to the git for more technical information.

 

The Pico-ice microcontroller development board design

What is an FPGA? And why is it mounted on this device next to Rasperry Pi‘s microcontroller?

An FPGA, or Field Programmable Gate Array, as opposed to ASICs (Application-specific integrated circuit, like the RP2 microcontrollers), are silicon chips where the connections between logic gates are programmable instead of being fixed. They offer unparalleled flexibility and speed, where an ASIC doesn’t make sense or isn’t practical:

  • One-off or small-scale projects with performance demands beyond what an off-the-shelf ASIC can offer or is economically viable
  • Projects where an ASIC solution doesn’t exist
  • Projects that require customization at the silicon level
  • Prototyping platforms for future ASIC chips

Pico-ice combines this kind of chip with an RP2040 or RP2350B microcontroller. The microcontroller is connected with the FPGA in a way to allow communication with, and programming of the FPGA. It offers all the flexibility of the FPGA with all the ease of use and peripherals of the RP2 microcontroller:

  •        Need a USB interface to talk UART? Use the RP2, avoid wasting FPGA space on a USB controller. 
  •       Need to measure a lot of very fast I/Os? Use the FPGA to do the measurements, transfer the results to the RP2 where storing and dispatching it elsewhere is easy.
  •          Need an application-specific interface? The FPGA can do that, and the microcontroller makes it easy to control.

 

Introduction to MicroPython

From the name, it could be assumed it has to do with Python, and it does!

MicroPython is a microcontroller-targeted implementation of Python 3, providing embedded platforms with access to one of the most beloved and easy-to-use programming language of our times.

Following this ideal, MicroPython provides all the basic features of desktop Python and offers similar ease of use.

You may imagine then that MicroPython is limited and slow, but that is far from being the case. Micropython offers seldom seen features on Microcontrollers, such as:

  •             Multithreading
  •        The ability to directly translate python code to machine code on the device
  •        Dynamically load compiled C modules

All this can be packed in less than half a megabyte of Flash and about 16K of RAM!

 

MicroPython on Pico-ice and Pico2-ice

Pico- ice and Pico2-ice feature RP2040 and RP2350B, respectively. Both of these microcontroller development boards support running the MicroPython firmware for RP2. This is a complete port of MicroPython, with all the features you’d expect from it:

  • Control of all hardware peripherals (GPIOs, SPI, I2C…)
  • Support for PIOs, even combined USB MSC and CDC for easily copying scripts to the flash storage

Additionally, the MicroPython firmware provided by tinyVision.ai, features quick access and configuration of the FPGA:

```python

from machine import Pin

import ice

fpga = ice.fpga(cdone=Pin(40), clock=Pin(21), creset=Pin(31), cram_cs=Pin(5), cram_mosi=Pin(4), cram_sck=Pin(6), frequency=48)

file = open("bitstream.bin", "br")

fpga.start()

fpga.cram(file)

```

This is all the code that is needed to load a bitstream (The FPGA configuration) into the Lattice FPGA memory on pico2-ice.

It’s possible to quickly change the loaded bitstream from the Python code. It’s also possible to load bitstream into flash dedicated to the FPGA with similar ease, and then starting the FPGA with only fpga.start().

Back to blog

Leave a comment