This time there will be a combined article – something about my new toy: logic analyzer, but also there will be introduction to diversity video receiver.
If you do anything with digital equipment or diy projects etc, logic analyzer could be very helpful tool for debugging. It’s great also for reverse engineering 🙂
From some time I had in my mind The Fabulous Logic Analyzer but parallel port is not what is available in modern laptops 🙁
Then I saw how Saleae Logic16 works:-) It was impressive, especialy that it works also under Linux. But 100-200 euros are a little over my budget for new toy, so I started searching for affordable alternatives. After some digging on the Internet, I found that old Saleae Logic, CWAV USBee SX and other cheaper logic analyzers are based on Cypress CY7C68013A chip and have almost nothing more than this chip alone. So, I found on Ebay Lcsoft CY7C68013A Mini Board prototyping board at less than $12 and now I have one 🙂
It’s not compatible with Saleae despite of programmed USB VID/PID. But because I try to use opensource where possible, so my only choice was Sigrok.
After getting hard time to meet Sigrok dependency (Python3, sdcc and other unusual software), it compiled and started to run. Sigrok comes with it’s own firmware for Cypress chip, so no pirating here:-)
It’s even better, because Lcsoft board has jumper to switch between ‘Saleae mode’ and ‘Cypress Development Kit’.
In Saleae compatible mode, Sigrok uploads standard firmware, so only 8 inputs are available at 24MHz sample rate.
But when we switch to ‘native’ mode, we have logic analyzer with 16 inputs 🙂 Of course 16 bit sampling is not available at 24MHz but when we narrow count of inputs up to 8, full sample rate is still available.
On the contrary, command line sigrok_cli is quite powerful.
Analyzing video receiver
So, it’s time to analyze something, and standard video receiver which comes with Fox700 transmitter as bundle is ideal for it 🙂
I was wondering from some time what exactly happens on i2c bus, ie. how tuner is programmed for specific frequency, and an opportunity to get it known arrived 🙂
As you can see on the above pictures, I added simple level converters with resistors and Zener diodes. It’s because logic of video receiver is 5V and Cypress is 3.3V chip. Of course I tried without Zener diodes, but weird things were happening 🙂
Sampling with sigrok_cli:
$ sigrok-cli --driver fx2lafw --device samplerate=24000000 --time 1s -p 0-7
Acquisition with 8/16 probes at 24 MHz
0:00000000 00000000 00000000 00000000
1:00000000 00000000 00000000 00000000
2:00000000 00000000 00000000 00000000
3:11111111 11111111 11111111 11111111
4:11111111 11111111 11111111 11111111
5:11111111 11111111 11111111 11111111
6:11111111 11111111 11111111 11111111
7:11111111 11111111 11111111 11111111
Ones and zeros are fine, but real power of Sigrok is ability to decode protocols:
$ sigrok-cli --driver fx2lafw --device samplerate=24000000 --time 10s -p 0-7 -o test.sr
$ sigrok-cli -i test.sr -a i2c:sda=0:scl=1
i2c: "ADDRESS WRITE" "0x68"
i2c: "DATA WRITE" "0x05"
i2c: "ADDRESS READ" "0x50"
i2c: "DATA READ" "0x00"
i2c: "ADDRESS WRITE" "0x61"
i2c: "DATA WRITE" "0x2b"
i2c: "DATA WRITE" "0x6c"
i2c: "DATA WRITE" "0x8e"
i2c: "DATA WRITE" "0xf0"
Initial write and read are some junk, I think that chip used for programming tuner, had originally other purpose and peripherials, but what is really interesting is data written at address 0x61.
According to documentation of SP5055 (synthesizer used on most tuners), 0x61 is it’s ‘always valid’ address, despite of signal on address settings pin, so it always works.
During that write there are 4 bytes transferred: 2 bytes of divider (unique for each selected channel), and 2 bytes for setting state of chip and external outputs (always the same).
So, let’s check what tuned frequency should be.
Divisor is 0x2b6c (MSB is transferred first) = 11116
According to datasheet, tuned frequency is:
f = divisor * 16 * Fcomp
Fcomp is frequency of quarz or external generator (typically 4MHz) divided by 512, so:
f = divisor * 16 * 4000000 / 512
In this case synthesizer is tuned to 1389500000Hz = 1389.5MHz
But that’s not the end – we must substract intermediate frequency 479.5MHz of tuner.
So, in fact we are tuned to 910MHz and this is exactly a 0 channel which was set on this receiver during test.
One thing I’m missing in sigrok_cli is lack of timestamps (number of samples could be shown using -v flag), but it’s open source and everyone could add this (maybe even I) 😉
Right now, when I know how to control tuner in receiver, I could make my own controller.
Why? Because documentation of SP5055 and some tuners shows that there is possibility to read also some data from tuner. Most interesting is little ADC connected typically to circuit that shows offset between set and receiving frequency. With this information it’s possible to automatically fine tune to exact frequency. It’s also possible to follow frequency change while transmitter warms up. And of course it’s possible to tune to any frequency in tuner range with 125kHz step 😉
Tuning multiple tuners at once isn’t also a problem, so making simple diversity based on video rssi it’s also possible,