It is needed for Yosys enabled video processing including edge detection. There are two problem with YOSYS enabled FPGA video processing:

  1. The tools do not yet support the full stack for Gowin and Lattice NX17/40 MIPI CSI hard cores, and
  2. There is a two year back order on Lattice NX17/40 FPGAs.

The solution is to ues an inexpensive Raspberry Pi Zero to bridge from the MIPI-CSI port to a Display Parallel Interface (DPI) to the FPGA. DPI is a very simple, low frequency, license free protocol for transmitting images using parallel single ended wires. The €12 Raspberry Pi Zero W supports a 24 bit RGB + HSync + VSync + Blank + Pixel Clock DPI output. This is an entirely open source tool chain, although obviously the chips themselves are all proprietary.

This simple inexpensive solution is surprisingly competitive. FPGAs can easily handle 28 wires, even on 4 layer circuit boards. There is the similar Digital Video Port (DVP) protocol but there are no cameras with a 24 bit wide DVP data path, so until now, only smaller or lower resolution DVP images were possible. AFAIK, only RPi will give you a 24 bit RGB parallel signal. (There are some MIPI -> DPI bridge chips, but then you also need a microcrontroller.) There are closed source FPGAs with MIPI CSI, but they are all more expensive and closed source. And even if you did buy a MIPI CSI FPGA, you would still want a microcontroller to run the software to set all of the registers in the image sensor. Best to start with the inexpensive ECPi Camera RGB888 application.

IcePi Zero Photo

ECPI Components

ECPi Camera uses a Raspberry Pi Zero and a Rasperry Pi compatible camera to drive an IcePi Zero board with a Lattice ECP5 FPGA. You can use either the $12 Raspberry Pi Zero W (one core) or the $15 4-core Raspberry Pi Zero 2W. You will also need a $16 micro SD card. Minimum 32 GByes, maximum 256 GBytes.

Raspberry Pi Zero FirmWare

The Raspberry Pi Zero camera video can be displayed on the screen and the screen can actually be a 24 bit + HSync + VSync + Black + Pixel Clock Display Parallel Interface driving an FPGA. At 60+Mhz, the display would be 1 MegaPixel. At 90+ Mhz it would be 1.5 MPixels. The Raspberry Pi Documenttion says that the peripherals can run at 125Mhz. If that actually worked, you could get a 2 MPixel Display. All numbers need to be reduced by the size of the images front and back porch.

FirmWare and GateWare

The Raspberry Pi firmware and the IcePi Zero FPGA gateware are in the Github Repository.

USB Output

For development it is fine to use the ECP5 DVI output. Good to have a
DVI switchbox. To show it off over Zoom, or capture images or video,
it is nice to have a DVI to USB dongle. Make sure to buy the USB 3
dongle, not a USB 2 dongle.

Questions???

Please send me an email

ECPi Details   View      

Lots of technical details about the Raspberry Pi Zero, ECP5 FPGA and making them work together.


▼
 ECPi. Assembly

▼
 RPi Zero Configuration

▼
 ECPi Clocks

▼
 ECPI Power

▼
 ECPi USB

▼
 Raspberry Pi Chips

▼
 Raspberry Pi Zero or Zero 2W?

▼
 Raspberry Pi Zero Details

▼
 IcePi Zero's DVI Demo

Raspberry Pi Camera Ecosystem   View      

There is huge camera ecosystem around the raspberry Pi.

This page links to some of the available options.


ECPi Camera RGB888   View      

The first ECPI camera application will input RGB888 from a Raspberry Pi Zero to the IcePi Zero FPGA at 640x480 resolution.

Digital Video Port (DVP) is a very simple, low cost, license free protocol for transmitting. images using parallel, low frequency single ended wires. The problem is that there are no DVP Cameras with a 24 bit wide data path, so only smaller, low resolution images are currently possible. One would have to use the more complex, higher frequency, proprietary MIPI CSI, but there are no open source FPGAs with MIPI CSI hard cores currently available. The Lattice Crosslink NX 17/40 is back ordered for two years. The Appicula project to support Gowin FPGAs with MIPI CSI hard cores just started and will take time to complete. There are closed source FPGAs with MIPI CSI, but they are all more expensive. And even if you did find a MIPI CSI FPGA, you would still need a microcontroller to set all of the registers in the inmage sensor. Best to use the ECPi Camera RGB888 application.

This is a reasonably simple application. On the newer (Bookworm and later) releases of the Raspberry Pi OS, you have to edit /boot/firmware/config.txt and add the following lines:

# Configure the GPU to output RGB888
dtparam=rgb888

# Set the device tree overlay sending the gpu output to the 28 pins. 
dtoverlay=vc4-kms-v3d

# Set the timings for the video display. 
dpi_timings=640 0 16 96 48 480 0 11 2 32 0 0 0 60 0 25175000 1

#The fields in order:
#h_active    = 640
#h_sync_pol  = 0      (negative)
#h_fp        = 16     (front porch)
#h_sync      = 96
#h_bp        = 48     (back porch)
#v_active    = 480
#v_sync_pol  = 0      (negative)
#v_fp        = 11
#v_sync      = 2
#v_bp        = 32
#v_offset_a  = 0
#v_offset_b  = 0
#pixel_rep   = 0
#frame_rate  = 60
i#nterlaced  = 0
#pixel_freq  = 25175000   (25.175 MHz)
#aspect      = 1      (4:3)

These values have not yet been tested.

You also have to configure the FPGA. The signal path between the RPi Zero and the FPGA is 28 bits wide. 24 bits of RGB data plus Horizontal Sync, Vertical Sync, Blank and clock. All but the clock are registered and then sent to a dummy module where you can add your logic, and from there, the signal is sent to the GPDI/HDMI/DVI output port. The clock is handled differently. It is sent to the PLL and then through the clock tree network, such that its output is aligned with the input clock, placing both the RPi Zero DPI output and the FPGA fabric in the same clock domain.



Built with the Forest WIki.
User contributed content is licensed under a Creative Commons CC By 4.0 License.