Page 1 of 1

Lime Chip Control

Posted: Sun Mar 24, 2013 4:28 pm
by pauloxley
Has anyone other than myself attempted to write control software for the Lime Chip. Perhaps the plan is to use the GUI utility program supplied by Lime.

Has the FPGA been coded to offer a SPI interface to the Lime Chip?

The task is non trivial with very complex code needed to tune the PLLs on the chip and calibrate the DC coupling between stages. There also is an option to trim the mixers for their second order intermod contribution. It would be helpful to have a discussion with others with interest in this subject.


Paul Oxley

Re: Lime Chip Control

Posted: Tue Mar 26, 2013 6:09 am
by bpadalino
We've got a good amount of the control code written as part of the FSK example, but it isn't nearly finished. We've got some changes we need to push up to it, but we're very open to suggestions on what the interface should be, especially for some of the more intricate settings.

Currently we envision the API to be pretty simple:
  • Enable/Disable TX/RX modules
    Set frequency (tune)
    Set gain
    Set bandwidth
    Calibrate
    Apply calibration settings
We've currently got the bulk of code written for general operation, but most of the calibration is still not done yet.

The plan is to make this a separate library that is portable across platforms such that as long as lms_spi_read() and lms_spi_write() is defined elsewhere, everything else works the exact same.

Thoughts?

Re: Lime Chip Control

Posted: Tue Mar 26, 2013 12:03 pm
by pauloxley
Thanks for the source code. I will study it to see what I can learn. Unfortunately, the Linux convention is not compatable with any Windows viewer. The line endings are different on Windows. I tried using Microsoft word, notepad and Visual Studio. They all display the c code as a single line. Thus the only way to view the code is on-line in the repository.

My code is written in C and is running under windows as a command line program. It was written that way to make it portable to Linux and MAC in the future.

Based on a casual reading of the code, the programs are similar. They both use SPI read/write common functions to communicate with the chip. Mine is named readreg(BYTE reg) and setreg(BYTE reg,BYTE value). One other difference on the setreg() function, it also does a readback comparison to see that the register is set. This probably isnt needed in the long run, but is useful for testing.

My application is receive only. So the only use of the transmit side is to provide a LO for an external mixer for frequency inputs below 300 MHz. In addition, the transmit section is used in one of the calibration routines to supply a frequency for the calibration of the LP filters. I also am building in a loop back capability to allow the user to test the receiver without an external signal generator.

Control of the sample rate is also included in my code. This allows applying Nyquist criteria for the selection of the bandwidth. Our test layout is based on the Lime Evaluation Board and a Lattice CPLD with an FX2 USB interface. The sample rate is changeable by using deicimation in the CPLD or other output functions which require a low sample rate.

The code also includes the capability to load the ADF PLL chip that is on the Lime Evaluation Board. The ADF chip allows the user to lock the TCVCXO to an external reference frequencY (ie: 10 MHz). The reference frequency will be user selectable. However, at present, the only option is 10 MHz. I expect that you will need similar code when the external 1PPS or 10 MHz reference capability is built in the FPGA.

The code also captures the data from the CPLD that is in a strange format. The data is reformated into integer values and placed in a circular buffer that is used for output functions. The system also calculates the mean sample value that is used as part of the calibration routines. In the future, the peak to peak value will also be used to set the gain which is fixed for Radio Astronomy Applications. The gain will be set to a value where the noise floor is near the low end of the ADC range, thus preserving the dynamic range for higher levels from objects being observed.

One of the issues learned the hard way is that the gain of the various stages on the Lime Chip have a large impact on the DC Calibration. We may need to limit the setting of the gain to points where the linearity is good.

At present, most of the code is working, but testing remains for the low frequency input. Development is needed on the gain setting.

Paul

Re: Lime Chip Control

Posted: Tue Mar 26, 2013 5:06 pm
by drmpeg
You can try Notepad++ to read the *nix format files.

http://notepad-plus-plus.org/

Also, here's some LMS6002D code from the UMTRX project.

https://github.com/chemeris/UHD-Fairwav ... host/utils

Ron

Re: Lime Chip Control

Posted: Wed Mar 27, 2013 8:15 am
by pauloxley
Thanks for notepad++. Unfortunately, it behaves the same. I highlighted the text in the gethub display and copied it into notepad++. The result was the same with everything on one line. Any other ideas?

Paul

Re: Lime Chip Control

Posted: Wed Mar 27, 2013 3:58 pm
by drmpeg
You can try clicking on the "Raw" button and then using "Save Page As" in your browser. With my system (Windows XP and Firefox 19.0.2), the resulting file has carriage returns and line feeds, so it looks correct in any editor (Notepad, WordPad, etc.).

Re: Lime Chip Control

Posted: Thu Mar 28, 2013 6:27 pm
by pauloxley
Thanks for the tip. It worked.

Paul