FRDM-K82F FlexIO Camera Demo

Document created by Anthony Huereca Employee on Dec 16, 2015Last modified by Anthony Huereca Employee on Dec 18, 2015
Version 3Show Document
  • View in full screen mode

One of the new features that can be found on the FRDM-K82F is the FlexIO header. It’s be specifically designed to interface with the very cost-efficient OV7670 camera, and uses 8 FlexIO lines to read data from the camera. By using the FlexIO feature, it makes it easy to connect a camera to a Kinetis MCU. A demo is included with Kinetis SDK 1.3 which streams the video data from the camera to a host computer over USB.



The FlexIO is a highly configurable module found on select Kinetis devices which provides a wide range of functionality


• Emulation of a variety of serial/parallel communication protocols

• Flexible 16-bit timers with support for a variety of trigger, reset, enable and disable conditions

• Programmable logic blocks allowing the implementation of digital logic functions on-chip and configurable interaction of internal and external modules

• Programmable state machine for offloading basic system control functions from CPU


All with less overhead than software bit-banging, while allowing for more flexibility than dedicated IP.


Running the Demo:

First you’ll need to setup the hardware. An 18 pin header needs to be installed on the *back* of the board. The camera is oriented this way to allow for use of shields on the top, even if the camera is being used. This way the functionality could be extended with WiFi or LCD shields.


After the header is soldered on, plug in the camera. It will look like the following when complete:


Next we need to program the K82 device with the example firmware. The software can be found in the Kinetis SDK FRDM-K82F stand-alone release, in the C:\Freescale\KSDK_1.3.0_K82\examples\frdmk82f\demo_apps\usb\device\video\flexio_ov7670 folder.


Open the project, compile, and program the example specific for your compiler like done for other examples. Make sure you also compile the USB Device library as well.


After programming the K82, unplug the USB cable from J5 (OpenSDA) and plug it into J11 (K82 USB). The board will enumerate as a generic USB video device called “USB VIDEO DEMO”. You can then use this device with any video capture software, like Skype or Lync.  Here's a shot of the clock in my cube:


The resolution is 160*120, the video image format is RGB565. You may need to manually adjust the focus by rotating the lens on the camera.


The frame rate can also be sped up by modifying line 342 in usb_descriptor.c:

5fps: 0x80,0x84,0x1E,0x00, /* Default frame interval is 5fps */

10fps:  0x40,0x42,0x0F,0x00,

15fps:  0x2A,0x2C,0x0A,0x00,

20fps:  0x20,0xA1,0x07,0x00,


The 160*120 max resolution was determined by the amount internal SRAM of the device, as there is not external RAM on the FRDM-K82F board.


More Information:

One of many places to buy the OV7670 camera module

OV7670 Reference Manual

FlexIO Overview

FlexIO Training presented at FTF

4 people found this helpful