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);
backlight.SetDriveMode(GpioPinDriveMode.Output);
backlight.Write(GpioPinValue.High);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, }; displayController.SetConfiguration(controllerSetting); displayController.Enable(); 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(); ov9655.SetResolution(Ov9655Controller.Resolution.Vga); byte temp = 0; while (true) { try { ov9655.Capture(); } catch (System.Exception) { } Thread.Sleep(10); } 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 ??