Programming Guide

This section provides the details of the programming requirements to operate the RPi Camera FMC hardware and customise functionality.

Cameras

Configuration of the cameras must be done over the I2C buses and the procedural details for doing so, including I2C addresses, register addresses and so on, is entirely dependent on the cameras being used. For this reason, the camera configuration details fall outside the scope of this guide. For information on programming for specific camera devices, such as the Raspberry Pi camera v2, we suggest that you refer to the documentation of our example designs.

Camera GPIO

The camera GPIO pins IO0 and IO1 can be controlled using the dedicated FMC pins that they connect to. In our example designs, we have connected them to the AXI GPIO IP and we control them using the AXI GPIO baremetal and Linux drivers. The procedure for controlling the camera GPIOs in this way can be found in the documentation of our example designs. Users of other IP for GPIO will need to refer to the documentation of the specific IP that they are using.

I/O Expanders

It should not be necessary to use the I/O expanders ( TI, I/O Expander, TCA9536DTMR ) to control the camera’s IO0 and IO1 pins, as the RPi Camera FMC provides the FPGA with dedicated I/O for controlling them. The I/O expanders were intended to be used by our production testing systems only. Nevertheless, we provide the following information for customers with use cases that we did not anticipate.

I2C address

Each of the 4x I/O expanders can be accessed over the I2C bus using the address 0x41. Note that there is no I2C MUX as each I2C bus is independently routed to the FPGA.

A6A5A4A3A2A1A0Hexadecimal
10000010x41

I2C registers

The table below lists the registers of the I/O expanders.

AddressRegisterRW
0x00Input portR
0x01Output portRW
0x02Polarity inversionRW
0x03ConfigurationRW
0x50Special functionRW

For registers 0x00, 0x01, 0x02 and 0x03, the bits 0 to 3 refer to the expander’s IOs: P0, P1, P2 and P3.

I/Os

The I/O expanders have 4x GPIOs, labelled P0, P1, P2 and P3. On the RPi Camera FMC, these I/Os are connected as follows:

Expander I/O pinBit maskConnects to
P00x01Camera IO0
P10x02Camera IO1
P20x04Not connected
P30x08Not connected

Use cases

The FPGA has dedicated pins for driving IO0 and IO1 for each camera, therefore it should not be necessary to use the I/O extender to control these pins, however below are a few examples for how to use it:

  • To read the value of IO0, read register 0x00 (Input port). The value of IO0 is the value of bit 0 of the read value.
  • To read the value of IO1, read register 0x00 (Input port). The value of IO1 is the value of bit 1 of the read value.
  • To write a 1 to IO1 and 0 to IO0, write value 0x02 to register 0x01 (Output port).

For more detailed information about using the I/O expanders, please refer to the device datasheet .

EEPROM

The 2K EEPROM is intended to store information that identifies the mezzanine card and also specifies the power supplies required by the card. This information is typically read by the system power management on the carrier board when it is powered up. In typical user applications, it should not be necessary to read the data on the EEPROM, and we highly recommend against writing to the EEPROM. Nevertheless, if you wish to access the EEPROM, it can be read and written to at the I2C address 0x50.

A6A5A4A3A2A1A0Hexadecimal
10100000x50

The EEPROM sits on the FMC card’s dedicated I2C bus which is separate from the I2C buses of the Raspberry Pi cameras. The FMC pins of the EEPROM’s I2C bus are shown below, and it is up to the user to determine their corresponding connections to the FPGA/MPSoC on the carrier board being used.

I2C bus signalFMC pin nameFMC pin number
SCL (clock)SCLC30
SDA (data)SDAC31

FMC EEPROM Tool

The Opsero FMC EEPROM Tool can be used to verify, reprogram or update the EEPROM contents of Opsero FMC products using an FPGA or MPSoC board such as the ZCU102 or VCU118 board.

Supported boards

The tool currently supports the following FPGA/MPSoC boards. You must have at least one of these boards in order to use the tool.

  • ZedBoard
  • ZCU102 Rev1.0 and Rev1.1
  • KC705
  • KCU105
  • VCU118
  • ZCU104

Download

The tool can be downloaded at the link below:

Opsero FMC EEPROM Tool v1.4

The zip file contains a boot file (bitstream or BOOT.bin) for each of the supported boards.

Usage instructions

To run the tool, follow these steps:

  1. Plug the FMC card you wish to reprogram into one of the FMC connectors of your FPGA/MPSoC board. The tool is designed to probe all of the FMC connectors on the FPGA/MPSoC board.

  2. If you are using the ZedBoard, be sure to set the VADJ jumper setting to 1.8V. If you are using the KC705, be sure that your FMC card can support a VADJ of 2.5V, which is the default setting of that board.

  3. Connect the UART of your FPGA/MPSoC board to a PC.

  4. For Zynq and Zynq MP boards, a BOOT.bin file is provided. Copy this file to your board’s SD card and configure it to boot from SD card. Then plug the SD card back into the board and power it up.

  5. For FPGA boards, a bitstream is provided with an embedded ELF file. Power up your FPGA/MPSoC board and then download the bitstream to the FPGA board using the Vivado Hardware Manager tool.

  6. Open a terminal program such as Putty and connect to the serial port of your FPGA/MPSoC board. If you see nothing in the terminal window, press ENTER to redisplay the menu.

  7. Use the menu options to do the following:

    • Program the EEPROM (p)
      You will be asked to select the FMC product from a list, and also to enter the product’s serial number. Note that entering incorrect information here can lead to your FMC card being damaged by a VADJ voltage that is greater than it’s true rating. If you are not sure about the product to select here, please contact Opsero first.