cxadc is an alternative Linux driver for the Conexant CX2388x video capture chips used on many PCI TV cards. It configures the CX2388x to capture raw samples from the input ports, allowing these cards to be used as a low-cost 28Mhz ADC for SDR and similar applications.
The regular cx88 driver in Linux provides support for capturing composite video, digital video, audio and the other normal features of these chips. You shouldn't load both drivers at the same time.
Build and install the out-of-tree module:
make && sudo make modules_install
Install configuration files::
sudo cp cxadc.rules /etc/udev/rules.d
sudo cp cxadc.conf /etc/modprobe.d
Now reboot and the modules will be loaded automatically. The device node will be called /dev/cxadc0. The default cx88 driver will be blacklisted by cxadc.conf. Module parameters can also be configured in that file.
Build the level adjustment tool:
gcc -o leveladj leveladj.c
Connect a signal to the input you've selected, and run leveladj
to
adjust the gain automatically:
./leveladj
Open /dev/cxadc
and read samples. For example, to capture 10 seconds
of samples:
sox -r 28636363 -b 8 -c 1 -e unsigned -t raw /dev/cxadc0 capture.wav trim 0 10
Most of these parameters (except latency
) can be changed using sysfs
after the module has been loaded. Re-opening the device will update the
CX2388x's registers.
Some TV cards (e.g. the PixelView PlayTV Pro Ultra) have an external multiplexer attached to the CX2388x's GPIO pins to select an audio channel. If your card has one, you can select an input using this parameter.
On the PlayTV Pro Ultra:
audsel=0
: tuner tv audio out?audsel=1
: silence?audsel=2
: fm stereo tuner out?audsel=3
: audio in to audio out
The PCI latency timer value for the device.
The fixed digital gain to be applied by the CX2388x (INT_VGA_VAL
in
the datasheet). Adjust to minimise clipping; leveladj
will do this
for you automatically.
By default, cxadc captures unsigned 8-bit samples. Set this to 1 to capture 10-bit samples, which will be returned as unsigned 16-bit values. In 10-bit mode, the sample rate is halved.
By default, cxadc captures at a rate of 8 x fSc (8 * 315 / 88 Mhz, approximately 28.6 MHz). Set this to 1 to capture at 10 x fSc (approximately 35.8 MHz).
Select the CX2388x input to capture. A typical TV card has the tuner, composite input and S-Video inputs tied to three of these inputs; you may need to experiment (or look at the cx88 source) to work out which input you need.
cxadc was originally written by Hew How Chee ([email protected]). See SDR using a CX2388x TV+FM card for more details.
- added support for i2c, use
i2c.c
to tune - set registers to lower gain
- set registers so that no signal is nearer to sample value 128
- added
vmux
andaudsel
as params during driver loading (for 2nd IF hardware modification, load driver usingvmux=2
). By defaultaudsel=2
is to route tv tuner audio signal to audio out of TV card,vmux=1
to use the signal from video in of tv card.
- change code to compile and run in kernel 2.6.18 (Fedora Core 6) for Intel 32 bit single processor only
- clean up mess in version 0.2 code
This version has been retargeted for Ubuntu 13.10 Linux 3.11 by Chad Page ([email protected]).
While still a mess, the driver has been simplified a bit. Data is now read
using standard read()
semantics, so no capture program is needed like the original
version.
For the first time, it also runs on 64-bit Linux, and seems to be OK under SMP.
- Update to work with Linux 5.1; older versions should still work.
- Tidy up the code to get rid of most of the warnings from checkpatch, and bring it closer in style to the normal cx88 driver.
- Make
audsel
optional. - Don't allow
/dev/cxadc
to be opened multiple times. - When unloading cxadc, reset the AGC registers to their default values. as cx88 expects. This lets you switch between cxadc and cx88 without rebooting.