Wiki

This version is outdated by a newer approved version.DiffThis version (15 Jul 2015 13:44) was approved by Lucian Sin.The Previously approved version (21 Feb 2013 11:01) is available.Diff

This is an old revision of the document!


AD-FMComms1-EBZ : no-OS Software Drivers

The reference design is a combination of hardware (the FMComms1 Card + the FPGA base platform), the HDL, and the software that is either running on the Microblaze, or ARM Cores.

XCOMM API

An API is available to be used on systems without OS to interact with the FMCOMMS1 board. The API provides all the necessary functions to control the various components on the FMCOMMS1 board.

 XCOMM API

The FMCOMMS1 drivers stack is structured on three layers:

  • PIC Communication Abstraction Layer – this layer implements all the functions need to communicate on I2C with the PIC located on the FMCOMMS1 board. Its purpose is to translate the SPI calls coming from the drivers in PIC I2C commands.
  • Device Drivers Layer – this layer contains the drivers for all the parts on the FMCOMMS1 board. Each driver defines all the registers for a specific part and implements the functions needed to interract with that part.
  • XCOMM API – here are implemented all the high level functions required to interact with the FMCOMMS1 board. This layer hides the implementation details of the actual device drivers and provides a convenient way to work with the board.

Below is presented a short description of all the functions provided in the API.

General Functions
int32_t XCOMM_Init (XCOMM_DefaultInit* pDefInit) Initializes the XCOMM board. Returns 0 in case of success, -1 otherwise.
int32_t XCOMM_Sync (void) Resync driver cached values by reading the XCOMM board. Returns 0 in case of success, -1 otherwise.
XCOMM_Version XCOMM_GetBoardVersion (XCOMM_ReadMode readMode) Gets the XCOMM board version string. Receives as parameter the read mode (driver or HW). Returns version struct with version string and error set to 0 in case of success; returns version struct with error set to -1 otherwise.
int32_t XCOMM_GetPicFwVersion () Gets the PIC firmware version. Returns the PIC firmware version number (0 to 100) in case of success, -1 otherwise.
Rx Functions
int64_t XCOMM_SetRxFrequency (uint64_t frequency) Sets the Rx center frequency. Receives as parameter the desired frequency in Hz and returns the exact calculated frequency in case of success or -1 in case of error.
int64_t XCOMM_GetRxFrequency (void) Gets the Rx center frequency. Returns the frequency in Hz stored in driver or -1 in case of error.
int32_t XCOMM_SetRxResolution (uint32_t resolution) Sets the Rx center frequency resolution. Receives as parameter the desired frequency resolution in Hz and returns the exact calculated resolution in case of success or -1 in case of error.
int32_t XCOMM_GetRxResolution (XCOMM_ReadMode readMode) Gets the Rx center frequency resolution. Receives as parameter the read mode (driver or HW). Returns the frequency resolution in Hz or -1 in case of error.
int32_t XCOMM_SetRxGain (int32_t gain1000) Sets the Rx gain. Receives as parameter the desired gain (x1000) in dB and returns the calculated gain (x1000) in case of success or -1 in case of error.
int32_t XCOMM_GetRxGain (XCOMM_ReadMode readMode) Gets the Rx gain. Receives as parameter the read mode (driver or HW). Returns the gain (x1000) in dB or -1 in case of error.
XCOMM_RxIQCorrection XCOMM_GetRxIqCorrection (uint64_t frequency, XCOMM_ReadMode readMode) Gets the Rx gain and phase correction for I and Q. Receives as parameters the center frequency used for the correction in Hz and the read mode (driver or HW). Returns IQCorrection struct with gain and phase correction for the frequency and error set to 0 in case of success; returns IQCorrection struct with error set to -1 otherwise.
Tx Functions
int64_t XCOMM_SetTxFrequency (uint64_t frequency) Sets the Tx center frequency. Receives as parameter the desired frequency in Hz and returns the exact calculated frequency in case of success or -1 in case of error.
int64_t XCOMM_GetTxFrequency (void) Gets the Tx center frequency. Receives as parameter the read mode (driver or HW). Returns the frequency resolution in Hz or -1 in case of error.
int32_t XCOMM_SetTxResolution (uint32_t resolution) Sets the Tx center frequency resolution. Receives as parameter the desired frequency resolution in Hz and returns the exact calculated resolution (in case of success) or -1 (in case of error).
int32_t XCOMM_GetTxResolution (XCOMM_ReadMode readMode) Gets the Tx center frequency resolution. Receives as parameter the read mode (driver or HW). Returns the frequency resolution in Hz or -1 in case of error.
XCOMM_TxIQCorrection XCOMM_GetTxIqCorrection (uint64_t frequency, XCOMM_ReadMode readMode) Gets the Tx gain and phase correction for I and Q. Receives as parameters the center frequency used for the correction in Hz and the read mode (driver or HW). Returns IQCorrection struct with gain and phase correction for the frequency and error set to 0 in case of success; returns IQCorrection struct with error set to -1 otherwise.
ADC Functions
int64_t XCOMM_SetAdcSamplingRate (uint64_t rate) Sets the sampling rate of the ADC. Receives as parameter the desired rate in Hz and returns the exact calculated rate in case of success or -1 in case of error.
int64_t XCOMM_GetAdcSamplingRate (XCOMM_ReadMode) Gets the sampling rate of the ADC. Receives as parameter the read mode (driver or HW). Returns the rate in Hz or -1 in case of error.
XCOMM_AdcTestMode XCOMM_SetAdcTestMode (XCOMM_AdcTestMode testMode, XCOMM_AdcChannel channel) Sets the test mode of the ADC. Receives as parameters the desired ADC test mode and the ADC channel to set the test mode for. Returns the new ADC test mode if success or -1 otherwise.
XCOMM_AdcTestMode XCOMM_GetAdcTestMode (XCOMM_ReadMode readMode) Gets the test mode of the ADC. Receives as parameter the read mode (driver or HW). Returns the ADC test mode in case of success or -1 otherwise.
int32_t XCOMM_SetAdcUserTestPattern (uint8_t* pattern) Sets the user test pattern of the ADC. Receives as parameter a buffer containing the test pattern (8 bytes) and 0 in case of success or -1 otherwise.
int32_t XCOMM_CalibrateAdcDco (void) Calibrates the ADC DCO clock delay. Returns the DCO clock delay code in case of success, -1 otherwise.
int32_t XCOMM_IsAdcDcoLocked (void) Checks if the ADC DCO is locked. Returns 1 if the DCO is locked, 0 otherwise.
DAC Functions
int32_t XCOMM_SetDacInterpolationFreq (uint32_t interp) Sets the DAC interpolation frequency. Receives as parameter the interpolation frequency in Hz and returns the set value in case of success or -1 in case of error.
int32_t XCOMM_GetDacAvailableInterpolationFreq (int32_t* valArray) Gets the available interpolation frequencies. Receives as parameter an array to store the return values. The size of the array must be 5, the last valid value in the array is followed by a 0.
int32_t XCOMM_SetDacCenterShiftFreq (uint32_t shift) Sets the DAC center frequency shift. Receives as parameter the frequency shift in Hz and returns the set value in case of success or -1 in case of error.
int32_t XCOMM_GetDacAvailableCenterShiftFreq (int32_t* valArray) Gets the available center shiftfrequencies. Receives as parameter an array to store the return values. The size of the array must be 17, the last valid value in the array is followed by a -1.
int64_t XCOMM_SetDacSamplingRate (uint64_t rate) Sets the sampling rate of the DAC. Receives as parameter the desired rate in Hz and returns the exact calculated rate in case of success or -1 in case of error.
int64_t XCOMM_GetDacSamplingRate (XCOMM_ReadMode readMode) Gets the sampling rate of the DAC. Receives as parameter the read mode (driver or HW). Returns the rate in Hz or -1 in case of error.
XCOMM_DacIQCorrection XCOMM_SetDacIqCorrection (XCOMM_DacIQCorrection daciqCorrection) Sets offset and phase correction for I and Q in DAC. Receives as parameter the desired correction. Returns IQCorrection struct with offset and phase correction and error set to 0 in case of success; returns IQCorrection struct with error set to -1 otherwise.
XCOMM_DacIQCorrection XCOMM_GetDacIqCorrection (XCOMM_ReadMode readMode) Gets offset and phase correction for I and Q from DAC. Receives as parameter the read mode (driver or HW). Returns IQCorrection struct with offset and phase correction and error set to 0 in case of success; returns IQCorrection struct with error set to -1 otherwise.
int32_t XCOMM_CalibrateDci (void) Calibrated the DAC DCI. Returns 0 in case of success or -1 in case of error.

Downloads

The latest stable source code can be downloaded from the Analog Devices github.

Using the XCOMM API

An example is provided in the source code on how to use the XCOMM API to:

  • initialize the board
  • test the ADC communication
  • test the DAC communication
  • set the VGA gain
  • set the receive and transmit frequencies
  • send a sinewave over the air and receive it back

The example code outputs on the UART the status of each operation as shown below.

 XCOMM Test Program Output

A UART terminal can be used to capture the output of the example program. The number of used UART port depends on the computer's configuration. The following settings must used in the UART terminal:

  • Baud Rate: 115200bps
  • Data: 8 bit
  • Parity: None
  • Stop bits: 1 bit
  • Flow Control: none

The example code is located in the “Common/main.c” file and the implementations of the ADC and DAC test routines can be found in the “Common/test.c” file. All the API functions are located in the “Common/xcomm.h” and “Common/xcomm.c” files.

After running the example program the system is configured to generate a sinewave and send it over the air using a 2.4GHz carrier. The signal is received back, brought to baseband again and digitized by the ADC on the FMCOMMS1. The I and Q samples generated by the ADC can be viewed using the Chipscope project from the “Chipscope” folder. This is how the output of the ADC looks like.

 ADC output

resources/fpga/xilinx/fmc/ad-fmcomms1-ebz/reference_design_no_os.1436960390.txt.gz · Last modified: 15 Jul 2015 13:39 by Lucian Sin