FEZ Portal Integration of Camera OV9655

Dear Forum members,

I am currently testing the FEZ Portal for it handiness in an educational environment. For our planned task we need to capture pictures → there should be a camera connected to a board.

To sum up: How can I run the camera on Fez portal board.

So I bought a OV9655 camera modul, because regarding to the wiki (Tutorials > Multimedia > Camera) its compatible with the SC20260M SOC of the FEZ Portal.

Regarding to the documentation of the board (FEZ Portal)
and the cam (OV9655)
I did the following connections between camera and board:

I wired it like provided and getting “System.Exception at GHI-Electronics.TinyCLR.Device.I2c.dll”
on line “var ov9655 = new Ov9655Controller(controller);”

Here is the full code:

using System.Diagnostics;
using System.Drawing;
using System.Threading;
using GHIElectronics.TinyCLR.Devices.Display;
using GHIElectronics.TinyCLR.Devices.Gpio;
using GHIElectronics.TinyCLR.Devices.I2c;
using GHIElectronics.TinyCLR.Drivers.Omnivision.Ov9655;
using GHIElectronics.TinyCLR.Pins;

namespace TinCLRButWorkingDIsplay
internal class Program
private static DisplayController displayController = null;
static void Main()
GpioPin backlight = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PA15);

        displayController =  GHIElectronics.TinyCLR.Devices.Display.DisplayController.GetDefault();

        var controllerSetting =
            new ParallelDisplayControllerSettings
                Width = 480,
                Height = 272,
                DataFormat = DisplayDataFormat.Rgb565,
                Orientation = DisplayOrientation.Degrees0, //Rotate display.
                PixelClockRate = 10000000,
                PixelPolarity = false,
                DataEnablePolarity = false,
                DataEnableIsFixed = false,
                HorizontalFrontPorch = 2,
                HorizontalBackPorch = 2,
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity = false,
                VerticalFrontPorch = 2,
                VerticalBackPorch = 2,
                VerticalSyncPulseWidth = 10,
                VerticalSyncPolarity = false,


        var screen = Graphics.FromHdc(displayController.Hdc);
        var controller = I2cController.FromName(SC20260.I2cBus.I2c1);

        // Camera
        var ov9655 = new Ov9655Controller(controller);
        ov9655.FrameReceived += Ov9655_FrameReceived;
        var id = ov9655.ReadId();


        byte temp = 0;

        while (true)
            catch (System.Exception)


        static void Ov9655_FrameReceived(byte[] data, int size)
            // 480 is screen width
            // 272 is screen height
            // 640 is original image width with VGA = 640
            displayController.DrawBuffer(0, 0, 0, 0, 480, 272, 640, data, 0);


Supposly three available clock pins (PCLK, VSYNC, XCLK) are missing at the FEZ Portal board to run the cam ??

For I2C issue, you may need pull up resistors.

Supposly three available clock pins (PCLK, VSYNC, XCLK) are missing at the FEZ Portal board to run the cam ??

The camera won’t work without these pins. They are very important pins.

So you can confirm the camera is not compatible with this board without changing the standard configuration ?

I read that the FEZ Portal board comes with intern Pull up resistors that I can enable by using these code:

var sda = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PB9);
var scl = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PB8);
var controller = I2cController.FromName(SC20260.I2cBus.I2c1, sda, scl, true);

Is the resistance of these internal resistors enough ?

internal pullup should work but your code is wrong, that why I2C doesn’t work.

if you provided sda, scl then need to be software.

Correct one should be:

var controller = I2cController.FromName(SC20260.I2cBus.Software, sda, scl, true);

So you can confirm the camera is not compatible with this board without changing the standard configuration ?

You need to find exactly the default dcmi pins that we provided. If you want different pins, it depends on what pin you wanted. On some pins you can use gpio low level to transfer alternate function to new pins so you can use it.

But in your case, likely you can’t, because PA8, this is MCO1 provides the clock for DCMI. And processor provides only one MCO1. You can try MCO2 but you need to use Marshal class to change the pin’s behavior.

MCO2 is PC9 that connects to SDCard, so you can’t use MCO2 anyway.

You can try PWM pin to generate the clock.

The clock is 48MH, 24MH, 16MHz, 12mHz, 9.6MHz, 8MHz. If you are using PWM and connect by wire, I think you should try 8MHz only.

But what you are doing is very far away from what we provided, and we have never tried it.

1 Like