otl-icoboard-pmodrgboled-demo is a simple demo for the IcoBoard FPGA board for the RasberryPI involving the PmodOLEDrgb, which is synthesized using the IceStorm tool-chain; a fully open-source synthesis tool-chain for the Lattice ICE40HX8K FPGA.
This demo was produced as part of a video-demonstration of the IcoBoard and the IceStorm tools featured on the OpenTechLab YouTube channel.
The PmodOLEDrgb is a Pmod (plug-in module) featuring a 96×64-pixel 16-bits-per-pixel colour OLED display, driven by the Solomon Systech SSD1331 display controller, which is controlled by the FPGA through a Mode-3 SPI slave interface, via Pmod port #1 on the IcoBoard.
Display outputs A-E left-to-right
This demo firmware sends full frame-buffer video images at 60-FPS from a selection of video sources, including:
- Video imagery sourced from block-RAM. At start-up the block-RAM is pre-populated with a static image (A). The contents of the block-RAM can also be replaced by the RasperryPI on a one-shot or repeated basis with stream-tool, so that still or moving images (B) can be displayed on the screen (see below).
- Pseudo-random video noise generated on-the-fly by a 20-bit Linear-feedback Shift Register (LFSR) (C).
- A video hack that produces a moving multi-coloured pattern (D).
- A video hack that fills the screen with a binary counter made of blocks (E).
The different inputs are selected by button presses to a PmodBTN - a Pmod featuring 4× hardware debounce filtered tactile switches, connected to Pmod port #2 on the IcoBoard.
The following tools must be installed...
- IceStorm tool-chain - needed for synthesis.
- FFmpeg - needed for 16-bit image conversion and video streaming with stream-tool.
- icoprog from within the icotools repository - needed to load the bitstream into the IcoBoard.
- Icarus Verilog - needed for simulation.
- GTKWave - needed for visualization of simulation results.
To synthesize bitstream...
$ cd fw/
$ make
Output is stored in demo.bin
.
To program the bitstream into the IcoBoard...
$ icoprog -p < demo.bin
$ cd fw/
$ make simulate-XXX
...where the available simulations are:
- simulate-pmodoledrgb_controller
- simulate-spi_ram_slave
Results will be displayed in GTKWave.
stream-tool is a simple C utility that reads frames from stdin, and sends them through SPI, in frame-buffer-sized messages.
$ cd stream-tool
$ make
Run sudo raspi-config
, and enable the SPI Interface wthin the Interfacing
Options menu.
ffmpeg can be used to transcode video files into a 96×64 RGB565 raw video stream...
$ ffmpeg -re -i /path/to/video.mkv -s 96x64 -an -f rawvideo -pix_fmt rgb565 - | \
./stream-tool
Alternatively, video can be streamed from a USB WebCam, or other V4L2 source...
$ ffmpeg -f v4l2 -i /dev/video0 -s 96x64 -f rawvideo -pix_fmt rgb565 - | \
./stream-tool
...where /dev/video0
is the device-node of the video source.