====== CC1020 SDR ====== By sampling the 8 bit I and Q filter test registers on the chipcon CC1020 ISM band transceiver IC it is possible to reconstruct the baseband. {{:guides:cc_1020_sdr_r.tar.gz|This file}} contains avr code for an atmega168, and c code for *nix (tested on ubuntu 10.04) for converting the serial data to a 8Ksps WAV stream. This can then be used by fldigi using file-audio-playback (or -stream on the custom fldigi build). This has been tested with the [[http://gb.mouser.com/ProductDetail/Texas-Instruments/CC1020EMK-433/?qs=sGAEpiMZZMuIes%252bYBRf57fU8KeClACMMKc7JNs%252b0NlI%3d|cc1020em(x)k-434 evaluation board from mouser]], running at 3.3v with the Lock pin connected to INT0 on the avr, and the "programming" spi interface on the cc1020 connected to the avr spi. The avr has to be clocked at an appropriate rate for 460800baud or faster serial to work - this has been tested with a 7.3728MHz crystal. ===== Test results ===== This technique has not been tested over long range, but bench tests with a very heavily attenuated signal suggest the front end noise figure for the 1020 is around 6.5dB. This mfsk64 data was recorded from a nxt2 transmitter with filtered pwm used to generate the small frequency shifts. The bandwidth is 9.6khz (mfsk64 spans approx 1.1khz). The PLL on the cc1020 allows steps of 225Hz to be made, here the local oscillator frequency was reduced by 225hz around point 800 on the horizontal axis. The horizontal line just below the ntx2 frequency is from an LCD monitor. The ntx2 signal is actually much stronger than the frontend noise and RFI, as can be seen by the disappearing background noise as the AGC adjusts. In fact the ADC on the chipcon is starting to saturate, causing the faint line at 0Hz during the transmissions. {{guides:waterfall.png|A waterfall display of some MFSK-64 packets}} A histogram of data from the I register (Q has the same shape) shows that the AGC is working perfectly to keep the samples in the +-127 range (signed 8 bit integer output). The probability density function is a Guassian as would be expected from a random noise source. {{guides:cc1020-histogram.png?800|Histogram of I output}} ===== ATLAS flight results ===== This data was recorded at a range of 280km with a yagi on CUED rooftop (damaged, estimated <6dBi). The signal to noise over 100Hz bandwidth is only around 6dB, so this is quite disappointing. A larger yagi mounted on the CUSF "trac-o-tron" directional mount and connected to an IC-7000 was getting good copy at this point, whereas this data produced >50% character error rate. Unfortunately it is very hard to estimate all the losses; [[http://books.google.com/books?id=4LtmjGNwOPIC&pg=PA121| some standard urban scattering equations]] suggest up to 5dB loss from scattering off buildings (LOS was at very low elevation over the city center), and atmospheric attenuation of 1dB. If the facts that the antenna was set up pointing off by about 30 degrees, and there was a metal handrail ~2m in front of the antenni during this test are also taken into account, it is easy to assume an 10dB loss over free space. This matches well with a matlab simulation of the cc1020 front end, which required 11dB noise figure to reproduce datasheet specs. Whilst a bit disappointing, a good LNA on the antenna will more than make up for the performance loss - this is planned as a future addition. {{:guides:waterfall_2atlas.png|}} ===== Active antenna support ===== An "active antenna" with built in low noise amplifier can be used with 3.3v supply down the coax through an RF choke and decoupling capacitors. If a pull up resistor is put between portc pin 2 and 3.3v, sufficient to give around 2 volts on the pin with the pin floating, then the presence of the amplifier can be detected (and closed or open circuit ruled out). Power will then be applied at bootup. Note that avr pins cannot supply more than 20ma. The led on port c pin 0 will flash twice at bootup to indicate a detected amplifier (one 100ms flash and a short 33ms flash as opposed to the normal single 100ms flash). ===== Usage instructions ===== [[http://www.mega-nerd.com/SRC/|Libsamplerate]] is required to resample the data to 8Ksps. A custom build of dl-fldigi in hab mode is required (./dl-fldigi --hab to use in hab mode) for optimal performance, otherwise you will lose data due to a poorly implemented delay function in fldigi. Hopefully this can be merged with the main dl-fldigi, but for now it can be found at [[https://github.com/Laurenceb/dl-fldigi]]. ==== Using without AFC ==== With dump.c compiled and the hardware connected to the machine, fire up dump (./dump /dev/tty e.g. ./dump /dev/ttyUSB0 ) and it should say "waiting for the stream to be opened". Then in fldigi/dl-fldigi go to file-audio-stream and locate stream.wav in the same directory as dump. Entering positive or negative numbers between -1 and +1 into dump retunes the cc1020 in steps of 225Hz. Alternatively a frequency in integer Hz can be entered, between 400e6 and 470e6. Always shut down by first stopping playback in fldigi before closing dump, or fldigi may hang. On bootup the cc1020 will be tuned to 434.075MHz. ==== Using with AFC ==== Compile dump.c as before. You will also need python installed. Run autotune.py /dev/tty then open fldigi/dl-fidigi as in the instructions above, but also setting rig control to use xmlrpc. You can now set the SDR frequency using the rig control entry box in fldigi. Any frequency between 400 and 470MHz is possible. The AFC built into the fldigi modem can control the PLL on the SDR to keep the audio frequency around the region of 2.5KHz, and it is also possible to manually retune by moving the red bars on the waterfall display to the transmitter frequency. The squelch option ('0' to enable) allows the SDR to make a somewhat crude attempt to avoid retuning in the middle of a telemetry packet by checking for a squelched signal. Unfortunately at low signal to noise the squelch usually has to be turned off, so under these circumstances a retune will take place whenever the frequency deviation becomes sufficiently large.