Articles

Published articles

Статьи

Создание сетевой камеры, использующей кодек Ogg Theora, на базе FPGA и под управлением встроенной ОС Linux -

Использование свободного программного обеспечения в устройствах на основе ПЛИС

перевод статьи "How to Use Free Software in FPGA Embedded Designs",опубликованной в в онлайновом журнале Xilinx Xcell

 

Использование Линукса в реконфигурируемой сетевой камере

Перевод статьи "Using Embedded Linux in a reconfigurable high-res network camera", опубликованной в   LinuxDevices »

Использование Линукса в высокоскоростной стробируемой камере с усилителем яркости

Перевод статьи "Embedded Linux in a High Speed Gated Intensified Camera", опубликованной в   LinuxDevices

Open source camera records geotagged video to SATA HDD

The content below is downloaded from www.linuxdevices.com/articles/AT5102023409.html, copyright(s) of the source apply.


Click here to learn
about this Sponsor:
Home  |  News  |  Articles  |  Polls  |  Forum

Keywords: Match:
Open source camera records geotagged video to SATA HDD
by Andrey Filippov

Foreword: This paper describes a small, Utah-based company overcoming several hardware and software challenges to create an advanced Linux-based camera. Based on an 200MHz Axis ETRAX FS and an FPGA, Elphel's modular 353 camera, combined with several new expansion modules, can now capture geo-tagged video to CompactFlash or 1.8-inch drives.

The article was written by Andrey Filippov, a Russian physicist who emigrated to the US in 1995, and founded Elphel six years later. This is Filippov's seventh whitepaper for LinuxDevices -- the others are listed at the end.

Enjoy . . . !


Open source camera records geotagged video to SATA HDD

by Andrey Filippov



Since last year's publication of Open source-based high-resolution cameras for Web developers, we at Elphel worked on several projects that add to the performance of our model 353-based camera. These projects encompass hardware, FPGA code, and software.

Hardware development was focused on adding the new extension boards to the camera. The only improvement on the camera main system board (10353) was the removal of the network boot button, a small pushbutton with a function similar to most such ball-point pressed buttons found on many devices -- to restore/update the flash memory image or restore defaults if held pressed during power up. That tiny pushbutton sometimes got peeled off the board (when pressed too hard), and was inconvenient to use remotely or when camera was mounted inside external enclosure.


Replacement of the boot button
(A fragment of the 10353E circuit diagram -- full version is available on Elphel Wiki)


In the new revision we use a small analog circuitry (the total footprint is even smaller than that of a pushbutton) that switches the system to the network boot mode if the power is applied several times with small intervals (up to ~5sec) between cycles. Being powered up for approximately 30 seconds (or left longer without power) resets the circuitry to the normal boot. As the power is provided through the network cable (cameras use IEEE802.3af Power over Ethernet), it is easy to "press" the virtual button remotely, either by manually inserting the other end of the cable several times, or by using a simple script to turn on/off power if using a manageable PoE switch.

Adding mass storage to the camera

Being limited by the 100Mbps Ethernet port available on the ETRAX FS CPU used in the camera, we were looking into using the IDE port of this processor to be able to record video data directly to a hard drive, or to CompactFlash cards in "True IDE" mode. We started with the 10349 board, trying different IDE connectors. Only a 1.8-inch drive with flex cable ("ZIF"-type) fit the small camera, all other cables (40/80 conductors for 3.5-inch or 44 conductors for the 2.5-inch disks) being too bulky. An obvious solution would be to use an IDE-to-SATA bridge chip, but here we ran into problems somewhat similar to the ones that free software developers see when developing drivers for the PC hardware: a lack of open documentation. There are multiple manufacturers who make IDE-SATA bridges, but I could not find datasheets that describe those chips, or even have a very minimum pinout diagram. All of them required signing an NDA (non-disclosure agreement) to get even this basic information, and that is not acceptable for Elphel, as we need at least the pinout of the chip to be able to include it in our circuit diagram that we release under GNU FDL and make available for download. And that pinout would be enough for us -- the bridge is transparent, and does need special drivers that would rely on some proprietary information.

So after failing to get the documentation required to add an IDE-to-SATA bridge chip, I decided to investigate first if the commercially available IDE-to-SATA adapters would work with the ETRAX FS. I purchased all such adapters I could find on the Internet (some turned out to be duplicates), and found that they are based on four different bridge chips. All seem to work fine when connected directly to the ETRAX FS IDE port. I was expecting those chips to be functionally the same, but it was a surprise for me to find out that they all are pin-compatible -- at least for most of the obvious pins, like four SATA signals, IDE, power, and the crystal. So I made a guess that they are identical, and used incomplete information found on the Internet for various chips -- including a circuit diagram for a discontinued chip -- in order to guess the pin-out.

That guess about pin-compatibility seemed to work, and the board designed with the SATA bridge chip ran fine without any additional tweaking, but I do not want to advertise the manufacturer of the particular chip we used in the first version of the 10369 board (anyway we may replace it in the future), so on the circuit diagram it is marked as "Generic SATA Bridge".

Connecting Compact Flash cards

With the CF cards capacity going up and the prices going down (32GB were less expensive than 16GB a year ago), it would be very attractive to add connectors for such cards to the camera. I wrote "connectors" as the CF cards support "True IDE" mode and can be directly connected to the same IDE signals available from the ETRAX FS (3 signals need resistor termination). It seemed to be a really easy job, with the most challenging part being mechanically fitting the card(s) inside the camera enclosure. I did not want to increase the overall dimensions of the camera. That was solved using a riser board (103691) that allowed us to fit two CF cards inside our standard camera. It is also possible to attach a 1.8-inch drive with ZIF connector by using a different riser board (103692). And, we could make more such boards with different termination (i.e. 2.5-inch or 3.5-inch HDD).


NC353L camera assembly with the 10369 interface board
and Compact Flash card installed

(Click to enlarge)


Mechanical challenges turned out to be not the only ones waiting for me when I worked on connecting the CF cards to the camera. These cards were hanging when the CPU tried to read them using DMA mode (and the card identified itself as supporting DMA mode). I tried to find the problem, and used all the tools I had. I added a bunch of printk's to the driver source, tried different speed settings for the DMA, and finally used an oscilloscope to spy on the signals between the CF card and the CPU. What I found was that the card did actually send the data using DMA mode, but always only for two "sectors" (1024 bytes total), regardless of the number of blocks to transfer written to the corresponding register. Then it silently hung, without activating an IRQ line, even if it was asked to transfer just a single block. And the CPU was relying on that interrupt to continue with the processing of the data read from the CF card. Careful examination of the data on the IDE bus did not reveal any problems (I was expecting something specific to the ETRAX). The same CF card with the DMA mode disabled in the driver worked fine (but slower, of course), as did the IDE hard drive (or SATA through the bridge) with DMA enabled. Googling the issue showed that I'm not the first to have problems with CF cards and DMA. The driver itself had a blacklist for some of the devices that caused problems.

Next thing was to try different CF cards, and see if the problem persisted. I went to newegg.com and ordered nine more, choosing various brands and models. Only one of them, the Sandisk Extreme(R) III 2.0GB, worked. All others exhibited the same behavior described above. So I opened up the first card (QMemory 16GB) to see what kind of a controller chip they use. It turned out to be a Silicon Motion SM222TF. I saw the same problem in a Transcend 32GB card with a SM223TF controller. Exhausting all my ideas, I emailed to the customer support address of the chip manufacturer. At first they were trying to redirect me to the card manufacturer, then admitted that "we have some firmware issue with DMA mode in the past, and I am not sure if the card you have can support DMA mode properly." But when I sent the detailed description of the behavior of the chip, asking if there is any way to mitigate the problem, they just stopped responding to my emails completely.

I still think it is possible to make the cards based on these chips work in the DMA mode without any possible secret commands or other tricks (if they actually exist), by modifying the behavior of the driver. Make it limit the transfers to just 2 blocks (rather easy -- I already tried that). And, more importantly, remove the dependency on the IRQ generated at the end of the transfer, by using the internally (in ETRAX or system DMA controller) generated interrupt when the required number of bytes were transferred -- however, that is a much larger driver modification that I did not have a chance to work on. It should be applicable to other architectures too, not just to the ETRAX FS IDE controller. This is my excuse for going into such detail describing the nature of the CF cards DMA problems.

USB as a system bus

The ETRAX FS, like many other microcontrollers, has an on-chip USB host controller that greatly simplifies attaching various peripherals to the camera. Those can be commercial devices like flash memories, WiFi adapters, sound cards, Bluetooth adapters, or cellular modems. Of course, it only works for devices that have open source drivers, as wrappers for proprietary x86 drivers would be of no help on the CRIS architecture. In addition to the off-the-shelf devices, it is now rather easy to implement a custom device with a USB interface. There are multiple adapter chips available (i.e. USB-to-RS-232), as well as programmable microcontrollers that have USB capabilities. Atmel makes one with just a 5x5 mm footprint. There are also in-between products on the market -- board-level systems with USB interfaces.

The 10369 board has a USB hub with four downstream ports (upstream being connected to the ETRAX through the inter-board connector). One of the ports is intended to be used for external USB devices; the other three, for internal "granddaughter" boards. Standard USB connectors and cables (even micro) are too large for use inside the camera, so the 10369 board has 0.5mm pitch 10-pin flex cable connectors. In addition to four needed for the USB, these (internal) connectors have 3.3V power, and four general purpose LVTTL I/Os routed to the FPGA on the main camera board (two of which are common for all connectors, and are currently programmed as i2c bus). The external USB connector is mounted on the back panel and connected to the 10369 board with a flex cable, so any of the internal connectors can be converted to external if more connector holes are made in the camera enclosure.

The USB hub on the 10369 board is designed to support USB 2.0, while ETRAX has only slower 1.1 interface. So, this feature will have to wait for the next generation of the camera system board that will support USB 2.0 and Gigabit Ethernet. That camera is not ready yet, but it will be described in the next year's article.

Inter-camera synchronization

The Model 353 camera in standard complectation uses a five-megapixel Micron (now Aptina) CMOS image sensor with an electronic rolling shutter (ERS) that uses fewer transistors per pixel than a snapshot shutter, but the result is that each scan line is exposed at different time. It is still important to have precise synchronization between multiple cameras or camera modules in a multi-camera system, and the sensors have a provision to start exposure+readout synchronized to an external signal.

Stereo vision is one such application. Two cameras with a horizontal stereo base can use ERS sensors if both sensors scan the same line at the same time and the sensors are mechanically adjusted to minimize vertical shift (or tilt) between the images, so each 3D point is exposed in both sensors at approximately the same time (difference is less than exposure time).

Another application that benefits from inter-camera synchronization is multi-camera systems for panoramic imagery. Knowing the precise timing of each image line acquisition helps when stitching the individual images into a panorama.

The 10369 boards have two individual sets of I/Os for the synchronization of several cameras:
  1. Small 4-pin flex cable connectors to interconnect multiple camera boards in a common enclosure
  2. Modular RJ-14 4-pin connectors for synchronizing multiple individual cameras
Each of the two channels has bi-directional opto-isolated I/O's and a non-isolated high current driver that can trigger multiple cameras. The FPGA code includes a programmable generator that can control the synchronization output drivers, and a programmable input delay generator driven by the selected opto-isolated inputs so each sensor can be triggered with a specified delay from the common for-multiple-cameras trigger. There is also circuitry to drive sensor trigger input.

The same FPGA module can be used in a single camera configuration to provide precise control over the frame rate. The period of the free running sensor is defined as a product of the number of lines by the number of pixels in a line (including invisible margins) by a pixel period, so there are some restrictions on the period that can be programmed. This triggered mode of sensor operation also simplifies alternating the exposure time between consecutive frames (i.e. for hard drive recorder (HDR) applications). In a free-running ERS mode, exposure overlaps between frames and it is not possible to control it independently for each frame.

There are more functions implemented in the 10369 board, such as RS-232 port, thermometer, clock/calendar. Details (as well as circuit diagram, PCB layout and BOM) are available on the wiki page.

Connecting USB peripherals

As we planned to geotag the images, we needed GPS, and that was easy. There are plenty of devices on the market that have a USB interface, and we tried Garmin GPS 18 USB. It is absolutely the same as running this device attached to a laptop running GNU/Linux: you enable kernel support of Garmin devices (usb-serial.c, garmin_gps.c ), and install an application to read the data. And as all the camera software comes with the complete source that is sufficient to rebuild the camera image (during installation it will download non-Elphel free software from respective sources), you do not need to be a member of Elphel team to add support for other devices. The source code and installation scripts are available on the Elphel project at Sourceforge as tarballs, in CVS repository, and each camera file system. The installation script includes all the source files in the flash image, so each camera internally has the source of the software it is running even in the case software was modified -- a nice feature for troubleshooting problems, not just bringing GPL compliance to a higher level.

The second device we considered was a digital compass with accelerometers for measuring roll/pitch of the camera. It is useful to orient video in space or create your personal "Street View"-like images. Additionally it might be a step to geo-locate the objects in the camera view, not just the camera itself. We used Ocean Server's OS5000-US, a 1-inch x 1-inch digital compass. It fit nicely inside the camera, attached with non-magnetic screws to the camera top cover. We just had to piggy-back the board with our 103693 adapter boards (without the large USB connector) and solder four USB wires directly between the 2 boards. Then, we connected the "sandwich" to the camera board with a flex jumper and added cp2101.c -- support for the CP2101 chip (usb to RS232 converter used in OS5000) to the kernel.

Images and metadata in the camera software

Images acquired from the sensor are compressed in the FPGA and delivered to the large (19MB) circular buffer in the camera system memory using DMA, so once programmed video data can be transferred to the buffer without any software intervention. The FPGA still generates an interrupt after each frame acquired. This interrupt is used to activate applications that were blocked while waiting for the next frame available, as well as to initiate other support functions:
  • Adjust exposure to compensate for the changing lighting conditions.
  • Update data structures related to the frames acquired, including the frame metadata.
In most cases, metadata is provided to the applications as Exif headers attached to the images stored in the circular buffer by the hardware. Exif processing in the camera is designed to be flexible, so support of additional fields can be easily added. It starts with an XML file with a description of the tags and data types used, required field sizes (until regenerated, the Exif header size in the camera has a fixed size). This file is processed by the PHP script in the camera that generates the header template containing all data in the header that does not change between frames. That includes complete tags for the constant data that does not change during camera operation (i.e. camera software version), and all but the data itself for the variable tags. Later, when the frames are retrieved, the driver treats this template similar to format in a printf function. In addition to this template, the exif.php script also provides the Exif device driver with the data structure information -- tag value and data length in bytes used for this tag. The driver does not interpret the data; it just stores data bytes written "to the tag" and uses it to fill the blanks in the template when requested. Additionally the tag sequence is provided, so the driver can later accept writes spanning several tags in a single write call (the camera is powered by only a 200MHz CPU, so performance issues are important).

The driver stores an array of Exif data structures (pure data to be combined with the template during output) -- one element per image in the circular buffer, element with index 0 is reserved for "now". Multiple sources write to the "now" structure, some from inside the kernel (i.e. exposure, time stamp), others from applications like the ones handling GPS or even the custom PHP scripts handling HTTP requests (i.e. changing image description while recording). When the frame interrupt happens, data from the "now" structure is copied to one in the array and the index is saved with the images so when the image is requested by one of the applications (image server, video streamer or video recorder), the metadata for that particular frame is retrieved. All writes to the "now" structure are atomic (interrupts are disabled), so writing multiple consecutive tags in a single write request guarantees that they will appear in the output all together.

When the Exif driver is enabled each application receives frames with the header containing metadata that can be read with most applications and such online services as Flickr (example) or Panoramio (example). If the camera detects GPS and/or compass during boot process, the related tags are included in the template; otherwise they are omitted. Unfortunately there are no Exif tags for roll and pitch of the camera, so we used a hack and encoded it as "Destination Latitude" for pitch and "Destination Longitude" for roll - this way the data is displayed by the applications.

These examples show geotagging of the individual frames. The camera tags each frame recorded -- currently it is up to 2592x1936@10.8 fps or 1920x1088@25fps -- but we could not find any application that makes use of the geotagged video. It would be fun to develop one, for example to "play" the geo data on Google Maps, create a screen capture, and combine it with the actual video. I'm sure more video camera with GPS/compass data will be available soon, so such applications will have wider application than just for Elphel cameras. Meanwhile, we made the cameras to generate KML files in parallel with recording video. The frame rate is much slower (interval between frames is one second or more), but the result can be immediately displayed in Google Earth application.

Under Development

There are several projects currently under development at Elphel:
  • Improving audio in the camera, supporting more USB adapters that can be used to record sound synchronized with the video

  • FPGA code and the software to support 10359 FPGA-based camera extension board. Currently it is capable of simultaneous acquisition images from three sensors, storing them in the on-board memory and sending to the camera one at a time. We plan to add processing to the image data.

  • Developing additional compression modes (based on JPEG) for efficient handling of the raw Bayer data from the sensor. There are now algorithms that result in very high quality restoration of the color images from the Bayer filter mosaic, but some are difficult to implement in the FPGA as they use image data rather far from the pixel to be interpolated, so in some cases it is easier to post-process the video after it was recorded. We used such an approach for a document scanning application. Currently, the FPGA in the camera can process 80MPix/sec in this mode, so the frame rate for the 5-megapixel sensor is limited by the sensor itself -- it is 15fps. The coming software release 7.2 will have this higher frame rate available.

  • Implementation of command queuing in the FPGA. In the existent firmware, once the image sensor and the FPGA are programmed, the video data will go to the buffer in the system memory automatically without software overhead. But, it all breaks up when you need to change some of the acquisition parameters, either sensor settings or the FPGA ones. In many cases, the acquisition process has to be stopped and re-programmed, or else the "broken" frames are output or the compressor may go completely out of sync with the sensor. Command queues in the FPGA allow scheduling sequences of commands (separately i2c ones for the sensor and direct ones to the FPGA internal registers) are activated after the corresponding frame sync pulse, up to six frames later than they were written to the queue. That allows coordinated reprogramming of the sensor and different FPGA modules, compensating for any latencies in the image acquisition and compression chain, and the "broken" frames are avoided. Additionally it reduces real-time requirements to the software, giving it more time before it has to take action. These features will also be available in the software release 7.2


About the author -- Andrey N. Filippov has over 25 years of experience in embedded systems design. Since graduation from the Moscow Institute for Physics and Technology in 1978, he worked for the General Physics Institute (Moscow, Russia) in the area of high-speed, high-resolution mixed signal design, application of PLDs and FPGAs, and microprocessor-based embedded system hardware and software design. Andrey holds a PhD in Physics from the Moscow Institute for Physics and Technology. In 1995 Andrey moved to the United States and after working for Cordin Company (Salt Lake City, Utah) for six years, in 2001 he started Elphel, Inc., dedicated to doing business in emerging field of open systems based on free (GNU/GPL) software and open hardware. This photo of the author was made using a Model 303 High Speed Gated Intensified Camera.



More papers by Andrey Filippov:

(Click here for further information)


FUEL Database on MontaVista Linux
Whether building a mobile handset, a car navigation system, a package tracking device, or a home entertainment console, developers need capable software systems, including an operating system, development tools, and supporting libraries, to gain maximum benefit from their hardware platform and to meet aggressive time-to-market goals.

Breaking New Ground: The Evolution of Linux Clustering
With a platform comprising a complete Linux distribution, enhanced for clustering, and tailored for HPC, Penguin Computings Scyld Software provides the building blocks for organizations from enterprises to workgroups to deploy, manage, and maintain Linux clusters, regardless of their size.

Data Monitoring with NightStar LX
Unlike ordinary debuggers, NightStar LX doesnt leave you stranded in the dark. Its more than just a debugger, its a whole suite of integrated diagnostic tools designed for time-critical Linux applications to reduce test time, increase productivity and lower costs. You can debug, monitor, analyze and tune with minimal intrusion, so you see real execution behavior. And thats positively illuminating.

Virtualizing Service Provider Networks with Vyatta
This paper highlights Vyatta's unique ability to virtualize networking functions using Vyatta's secure routing software in service provider environments.

High Availability Messaging Solution Using AXIGEN, Heartbeat and DRBD
This white paper discusses a high-availability messaging solution relying on the AXIGEN Mail Server, Heartbeat and DRBD. Solution architecture and implementation, as well as benefits of using AXIGEN for this setup are all presented in detail.

Understanding the Financial Benefits of Open Source
Will open source pay off? Open source is becoming standard within enterprises, often because of cost savings. Find out how much of a financial impact it can have on your organization. Get this methodology and calculator now, compliments of JBoss.

Embedded Hardware and OS Technology Empower PC-Based Platforms
The modern embedded computer is the jack of all trades appearing in many forms.

Data Management for Real-Time Distributed Systems
This paper provides an overview of the network-centric computing model, data distribution services, and distributed data management. It then describes how the SkyBoard integration and synchronization service, coupled with an implementation of the OMGs Data Distribution Service (DDS) standard, can be used to create an efficient data distribution, storage, and retrieval system.

7 Advantages of D2D Backup
For decades, tape has been the backup medium of choice. But, now, disk-to-disk (D2D) backup is gaining in favor. Learn why you should make the move in this whitepaper.

 


Got a HOT tip?   please tell us!
Free weekly newsletter
Enter your email...
Click here for a profile of each sponsor:
PLATINUM SPONSORS
(Become a sponsor)

ADVERTISEMENT
(Advertise here)

Check out the latest Linux powered...

Mobile phones!

MIDs, UMPCs
& tablets

Mobile devices

Other cool
gadgets



BREAKING NEWS

• MontaVista touts Android readiness
• Via panel PC resists shock, liquids
• Linux provider touts support award
• "World's smallest humanoid robot" runs Linux
• Linux connects TVs to 'Net video
• Mot camera-phone runs widgets
• Linux-ready MILS kernel gains POSIX
• Multimedia processor plays H.264 video
• $7 ARM9 SoC gains mainline support
• Mini-ITX board has HDMI port
• Papers sought for Embedded Linux Conference
• Rugged Linux wrist computer upgraded
• Adobe unleashes 64-bit Flash
• USB 3.0 debuts
• Spotlight on Moblin.org Linux


Most popular stories -- past 90 days:
• Open source phone goes mass-market
• Tinest Linux system, yet?
• Garmin Nav devices run Gnome Linux
• ARM9 board boots Debian in 0.69 seconds
• Low-cost laptop runs Linpus Linux
• Linux-friendly Beagle fetches $150
• Mini Linux PC breaks $100 barrier
• Open source camera records geotagged video to SATA HDD
• Open set-top box ships
• First $100 laptop runs Linux


DesktopLinux headlines:
• "Moonlight" ready to shine
• Adobe unleashes 64-bit Flash
• Debian Lenny installer arrives
• Ubuntu announces ARM port
• Amazon offers Linux XOs
• Windows 7 "no threat" to netbook Linux
• Creative frees Sound Blaster driver code
• Linux, netbooks threaten Microsoft's fat profits
• Ibex inspires GNOME switch
• Linux to outship Windows in 2009?


Also visit our sister site:


Sign up for LinuxDevices.com's...

news feed

Home  |  News  |  Articles  |  Polls  |  Forum  |  About  |  Contact
 

Ziff Davis Enterprise Home | Contact Us | Advertise | Link to Us | Reprints | Magazine Subscriptions | Newsletters
Tech RSS Feeds | White Papers | ROI Calculators | Tech Podcasts | Tech Video | VARs | Channel News

Baseline | Careers | Channel Insider | CIO Insight | DesktopLinux | DeviceForge | DevSource | eSeminars |
eWEEK | Enterprise Network Security | LinuxDevices | Linux Watch | Microsoft Watch | Mid-market | Networking | PDF Zone |
Publish | Security IT Hub | Strategic Partner | Web Buyer's Guide | Windows for Devices

Developer Shed | Dev Shed | ASP Free | Dev Articles | Dev Hardware | SEO Chat | Tutorialized | Scripts |
Code Walkers | Web Hosters | Dev Mechanic | Dev Archives | igrep

Use of this site is governed by our Terms of Service and Privacy Policy. Except where otherwise specified, the contents of this site are copyright © 1999-2008 Ziff Davis Enterprise Holdings Inc. All Rights Reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis Enterprise is prohibited. Linux is a registered trademark of Linus Torvalds. All other marks are the property of their respective owners.

Open source-based high-resolution cameras for Web developers

The content below is downloaded from www.linuxdevices.com/articles/AT4415936647.html, copyright(s) of the source apply.


Click here to learn
about this Sponsor:
Home  |  News  |  Articles  |  Polls  |  Forum

Keywords: Match:
Open source-based high-resolution cameras for Web developers
by Andrey N. Filippov (Apr. 11, 2007)

Foreword: This article describes the products and product design philosophies of a small Utah-based company offering high-quality, intelligent, network-enabled cameras based on open source hardware and software. Elphel hopes its newest modular camera design will attract Linux software and FPGA engineers interested in exploring high-definition videography, among other innovative applications.

The article was written by Andrey Filippov, a Russian physicist who emigrated to the US in 1995, and founded Elphel six years later. This is Filippov's sixth whitepaper for LinuxDevices -- the others are listed at the end. Enjoy . . . !




High Resolution Cameras for Web Developers

by Andrey Filippov


I believe that with our new 353/363 series of Linux-based network cameras we are one step closer to my dream of building hardware that is friendly to software developers. This time it is not only about gurus who can easily hack kernels and create drivers, but about usability for a much wider audience.

This article covers both the new hardware developed for the 353/363 series of the cameras, as well as the software these cameras are running or could run in the future.

Evolution of Elphel cameras

From our very first camera, I tried to keep the designs as universal as possible so that the camera (or parts of it) could be used for as-yet unimagined purposes. Hardware development (from the circuit design through PCB design, testing, and manufacturing) is rather expensive, and the cost of even minor changes on the boards is high. Multiple hardware revisions also result in incompatible hardware that increases the cost of customer support.

Our original Model 303 was designed around the Axis ETRAX100LX processor, which has the nice feature of a hardwired network boot loader so that without any additional connectors and cables, the camera firmware can be easily field-upgradeable even if the contents of the flash memory are corrupted by accident. The camera consists of two boards -- the "computer" part and the sensor board -- allowing us to upgrade the camera when new sensors became available without changing the main board.

The next level of universality was achieved when we included a reconfigurable FPGA in the subsequent Model 313 camera. This new part both interfaces to the sensor board and provides the resources for image processing and compression. All of the signal pins on the sensor interface connector are reconfigurable (flexible functional designation, direction, and optional pull-ups and pull-downs are available) to accommodate different types of imagers -- directly for the CMOS sensors and through the additional FPGA for the CCDs.

This approach paid off when we were developing our third-generation Model 323 camera, which supports large Kodak KAI-11000 and KAI-11002 CCD image sensors. In this camera, we had only to develop a circuit board around the sensor -- the rest was done by using a pair (to increase processing speed) of unmodified processor boards from the Model 313 camera. Even most of the FPGA and software code was reused, which allowed us to significantly decrease development time.

As we began work on our fourth-generation camera, we targeted several different applications, and developed multiple boards that can be interconnected in different combinations to make different devices. The core module (10353) preserves the same overall design ideas of the earlier cameras -- a computer running GNU/Linux, network connection with PoE (IEEE802.3af), and a reconfigurable FPGA that interfaces the sensor board, has individual SDRAM memory and interfaces with the embedded computer both in PIO and DMA modes.


Processor board of Elphel models 353/363 cameras
(Click to enlarge)

The physical dimensions of the 10353 board are the same as those of its predecessors -- 3.5 x 1.5 inches -- but most of components are upgraded:
  • 200MHz Axis ETRAX FS processor
  • 100Mbps Ethernet port
  • 1200K gates Xilinx Spartan 3e FPGA
  • 64MB of system SDRAM
  • 128MB of NAND flash
  • 64MB of image buffer DDR SDRAM attached directly to the FPGA
  • 30-pin flex cable connector for the sensor boards
  • 30-pin high density daughter board connector, that includes serial port, USB and 12 GPI/O pins connected to the FPGA that can be used as 6 differential pairs
  • 40-pin connector that carries IDE signals for an optional direct hard drive connection
  • 4-pin header to provide power to the daughter board (48VDC input power and 3.3VDC system power), alternatively it can be used for powering the 10353 board itself

Elphel 353/363 camera modules

The processor board is accompanied by a number of add-on boards (see detailed description on a wiki page) that can be combined to make different products. Initially we offer two types of the cameras:
  • The Model 353 has the same dimensions as our earlier model 333, and is intended for video applications. It has a 1/2-inch format CMOS image sensor and CS lens mount.

  • The Model 363 (available in Q3 2007, and expected to start at about $4,000) is intended for acquisition of several frames of high resolution still images per second. It includes a 35mm format interline Kodak CCD (11 or 16MPix), and is compatible with standard 35mm lenses, including the electrical interface.


Elphel 353/363 camera modules
(Click to enlarge)

Currently we have two boards that use the inter-board connectors of the 10353:
  • The 10357 board has eight CompactFlash slots, and a reconfigurable FPGA that connects them to the 10353 board's IDE port. With currently available 16GB CF cards, it can provide up to 128GB of solid-state storage for the camera. Initially we plan to use the FPGA as a simple multiplexer of four master/slave IDE devices (CF cards in IDE mode), but it is possible to implement parallel access to the cards (i.e. RAID of some type), and present them to the CPU as a single IDE device. Alternatively this board can be used as a general purpose FPGA I/O device, as most of the FPGA pins go directly to pin headers and can be programmed for custom functions.

  • The 10349 interface board includes RS-232 connector useful as a debug console for software development. By default, it gets all the boot messages and printk output. It also has an IDE connector (2mm pitch, compatible with 2.5" hard drives), and a USB hub with one external USB connector. In addition to built-in functions, this board can be used for prototyping, since it has multiple solder points and additional pin headers for custom I/Os. Custom prototype boards can be mounted on top of the 10349 with wire connections between the two.
The currently available sensor board for the 10353 is the 10338, which includes a 5MPix Micron CMOS image sensor. The two boards together comprise the electronic part of the Model 353 camera.

The Model 363 camera uses a sandwich of two boards. One is the 10347, which includes an FPGA that performs preliminary image processing, and controls the CCD timing, video ADC, and analog voltages required for the imager operation, as well as providing the electronic interface for the lens and external synchronization. The other is a sensor board -- a 10342 board with KAI-11002 for the 11MPix model, and a 10344 with KAI-16000 for the 16MPix model. Both of these boards include high-current CCD phase drivers and DACs for bias voltages.

Another board, the 10359, may be used to connect several sensor boards to a single processor board. It is not just a video multiplexer, but rather has the same 1200K gate FPGA and 64MB SDRAM memory as the processor board, and can reuse some of the Verilog code. This board can be programmed to perform additional image processing before video data reaches the processor board. For instance, it can be used for stereo image processing to extract 3-d information, or track camera orientation using an additional high frame rate/low resolution sensor, in order to compensate for Electronic Rolling Shutter distortion. Such distortion takes place because each line in most CMOS sensors is acquired at a different time, so if the camera is panned horizontally, then vertical objects will look tilted.

The FPGAs on the 10359 and 10347 boards are configured using the JTAG port, with these signals sharing lines in the flex cable with the data signals. One line is dedicated to configuration, while the rest switch to normal operation mode as soon as the FPGA starts.

Camera for web developers

Last year in AJAX, LAMP, and liveDVD for a Linux-based camera I described a web interface for the camera that used JavaScript on the client computer. But while developing this AJAX application I had to "cheat," because CGI applications that already existed in the camera did not have all the server functionality I needed. So, I had to interrupt JavaScript/HTML coding, and modify/add camera CGI executables and write additional shell scripts to fill the gaps. Of course, this approach would be much more difficult for somebody less familiar with the camera internals. Writing C applications and shell scripts to run in the camera is not really a "rocket science," but still limits the number of developers who can create web applications for the camera.

It would be much nicer if AJAX developers had familiar tools at their disposal for both client and server programming. Having just upgraded both system memory and the CPU of the camera, I was shopping around for a better solution -- even if it would be more expensive (in terms of memory/CPU usage). On the Axis developer WIKI, I found that it is easy to run PHP on ETRAX processors. I tried it, and it really is. The stripped binary turned to be just over 2MB -- not a problem for the 64MB system. After some quick patching of the Boa web server that comes as a part of the software distribution for Axis Development Boards, I was happy to see phpinfo() served by the camera.

I did not yet make any benchmarks, but loading 2MB executable for even the simplest request to the camera seemed a little pricey to me. But, this is how CGI works: the program is launched by the web server for each request to it, and generates a response and terminates. The solution to this problem is a well known extension to the CGI specs called FastCGI. FastCGI allows persistent programs to serve multiple requests without termination and reloading. For a big program like PHP, the gain is obvious. Additionally, the same instance of PHP can execute many different scripts.

Unfortunately Boa does not support fastCGI, and instead of modifying it, I looked for alternative servers that already have fastCGI support. I decided to try lighttpd. I started with the latest version (lighttpd-1.5.0-pre), installed it in parallel with the existent boa, and tried to download a big memory-based file with wget. Something was wrong, because lighttpd was nearly five times slower than boa. I tried this and that without any success, and then installed the previous lighttpd release, version 1.4.13. Bingo! Performance was consistently 15 percent faster than the pre-installed boa (8.3MB/s vs. 7.2MB/s). I changed a configure parameter for PHP, recompiled it, tweaked lighttpd config, and phpinfo() replied with "Server API CGI/FastCGI." So now we have lighttpd+fastCGI+PHP working together in the camera. We still preserved boa and PHP in CGI mode in the camera, though, pending more benchmarks for both servers and CGI vs. FastCGI.

More work is needed to give PHP scripts full control of the camera. Current software (most parts ported from earlier camera models) interfaces with driver parameters using ioctl functions that are not available in PHP. So, while preserving the legacy interface, we are adding alternative access to drivers using PHP-friendly fread() and fwrite() functions.

Community-driven applications

Working on development of network cameras we did not seriously consider Elphel products for filming and cinema applications. But that is changing now because of community initiative. It first started when Phil Stone began to use these cameras (first the model 313, that had a lower frame rate, then later the 333) for outdoor filming of special high-resolution video for bicycle trainers.

Next, we started to feel interest (and some pressure too) from the community of digital video enthusiasts, at least some of whom are eager to hack their cameras and push the limits of the available technology. This audience is very interesting for us, as they are open to experimentation and are able to test and use our cameras before these products are ready for the general customers. Most inspiring is that they are able to use the cameras in ways different from what we designed them for.


Custom DV camera based on Elphel Model 333 (by Daniel Lipats)
(Click to enlarge)

Naturally enough this community only partially intersects with the community of Linux users and not so many of them are experienced programmers. And our attempt to lower the entrance barrier for the camera software development is targeted to suit these particular users too.

I hope that some of the LinuxDevices readers may get interested enough to be able to join the community project of developing a high definition cinema camera (there is a page for it started on Elphel Wiki). Combined expertise has a great potential.



About the Author -- Andrey N. Filippov has over 25 years of experience in embedded systems design. Since graduation from the Moscow Institute for Physics and Technology in 1978, he worked for the General Physics Institute (Moscow, Russia) in the area of high-speed high-resolution, mixed signal design, application of PLDs and FPGAs, and microprocessor-based embedded system hardware and software design. Andrey holds a PhD in Physics from the Moscow Institute for Physics and Technology. In 1995 Andrey moved to the United States and after working for Cordin Company (Salt Lake City, Utah) for six years in 2001, he started Elphel, Inc., dedicated to doing business in emerging field of open systems based on free (GNU/GPL) software and open hardware. This photo of the author was made using a Model 303 High Speed Gated Intensified Camera.



More by this author


Related Stories

(Click here for further information)


FUEL Database on MontaVista Linux
Whether building a mobile handset, a car navigation system, a package tracking device, or a home entertainment console, developers need capable software systems, including an operating system, development tools, and supporting libraries, to gain maximum benefit from their hardware platform and to meet aggressive time-to-market goals.

Breaking New Ground: The Evolution of Linux Clustering
With a platform comprising a complete Linux distribution, enhanced for clustering, and tailored for HPC, Penguin Computings Scyld Software provides the building blocks for organizations from enterprises to workgroups to deploy, manage, and maintain Linux clusters, regardless of their size.

Data Monitoring with NightStar LX
Unlike ordinary debuggers, NightStar LX doesnt leave you stranded in the dark. Its more than just a debugger, its a whole suite of integrated diagnostic tools designed for time-critical Linux applications to reduce test time, increase productivity and lower costs. You can debug, monitor, analyze and tune with minimal intrusion, so you see real execution behavior. And thats positively illuminating.

Virtualizing Service Provider Networks with Vyatta
This paper highlights Vyatta's unique ability to virtualize networking functions using Vyatta's secure routing software in service provider environments.

High Availability Messaging Solution Using AXIGEN, Heartbeat and DRBD
This white paper discusses a high-availability messaging solution relying on the AXIGEN Mail Server, Heartbeat and DRBD. Solution architecture and implementation, as well as benefits of using AXIGEN for this setup are all presented in detail.

Understanding the Financial Benefits of Open Source
Will open source pay off? Open source is becoming standard within enterprises, often because of cost savings. Find out how much of a financial impact it can have on your organization. Get this methodology and calculator now, compliments of JBoss.

Embedded Hardware and OS Technology Empower PC-Based Platforms
The modern embedded computer is the jack of all trades appearing in many forms.

Data Management for Real-Time Distributed Systems
This paper provides an overview of the network-centric computing model, data distribution services, and distributed data management. It then describes how the SkyBoard integration and synchronization service, coupled with an implementation of the OMGs Data Distribution Service (DDS) standard, can be used to create an efficient data distribution, storage, and retrieval system.

7 Advantages of D2D Backup
For decades, tape has been the backup medium of choice. But, now, disk-to-disk (D2D) backup is gaining in favor. Learn why you should make the move in this whitepaper.

 


Got a HOT tip?   please tell us!
Free weekly newsletter
Enter your email...
Click here for a profile of each sponsor:
PLATINUM SPONSORS
(Become a sponsor)

ADVERTISEMENT
(Advertise here)

Check out the latest Linux powered...

Mobile phones!

MIDs, UMPCs
& tablets