A few months ago I had purchased two Sony FCB-EX470L block cameras (an ebay bargain!) with the intention of playing around with machine vision, image processing, and stereo vision which would lead me into building an autonomous robot.
I had been intending to design and build a video capture board using two NXP SAA7113‘s for video input, an FPGA, ARM9 and Ethernet, however as things like this always go time and money were lacking.
I was browsing dealextreme a few weeks ago and came across a very cheap USB 2.0 video capture device with composite, S-Video and stereo audio inputs, the device was called EasyCap. I immediately did some research (google search) on the device and found an open source Linux device driver named stk11xx which seemed like it would support it. So I ordered two of them!
Once I received the devices, first thing I did was pull them apart, I was pleasantly surprised to see that the cables came in to a connector which I had housings, crimps and a crimping tool for (Molex PicoBlade p/n: 51021-0800, Digkey p/n: WM1726-ND), so I wired up a cable direct from the camera block to the EasyCap using the S-Video C, Y and GND signals. The PCB looked like it had been manually re-worked, there was a large amount of dried up flux around some of the chips, so I cleaned it up with flux remover, this is to be expected with devices so cheap out of China.
I had quite a bit of trouble getting a picture out of the driver, first of all the latest release of the driver which at the time was 2.1.0 would not compile under my kernel (2.6.31). After reading through some forums of people in the same situation it turns out that I needed the trunk of the subversion repository, so I checked it out and compiled it, it compiled fine and loaded into the running kernel without any problems. I ran mplayer with the suitable command line switches but all I got was a blank window, I could not seem to get any picture from the device even though multiple people reported it working fine.
After a while I gave in and decided to try it under Windows. The day I was testing this I did not have the CD that came with the device, so I found some drivers on the net from a forum that explained how to get EasyCap working in Win XP SP3. I got the drivers installed and ran the application that came with it, selected NTSC-M, S-Video, enabled Preview, and it worked! A very clear 640×480 @ 25fps appeared, I was very happy with the quality of the video. So this tells me that the hardware is working fine, which is what I needed to know before proceeding with the Linux driver.
The first thing I thought could be causing the problem of it not working in Linux is that perhaps the stk11xx driver is hard-coded to only use the composite video input, so I plugged in a composite source and tried it again, It worked! It was clear what I now needed to do, I grabbed the NXP SAA7113 datasheet, looked up which registers would need changing to switch from composite video to S-Video input, there were a few combinations so without tracing the tracks on the PCB to figure out which I needed, I just changed the register values, going through modes that supported S-Video input one by one until I got it working.
I will do another post shortly with more detailed information on what is required, however if you can’t wait, all I had to do was write to the SAA7113’s Video control register to change the mode, the existing code was writing 0x80 to register 0x02, the lower 4bits set the mode, I needed to write 0x87, so I just replaced every line I could find that wrote 0x80 to register 0x02 and changed it to write 0x87 and now it is all working great from the S-Video input! I am very happy with this purchase.