no-OS
Macros | Functions
ad9208_api.c File Reference

Contains AD9208 APIs for ADC Chip Level Configuration and Control. More...

#include "ad9208_api.h"
#include "ad9208_reg.h"
#include "api_errors.h"
Include dependency graph for ad9208_api.c:

Macros

#define AD9208_IP_CLK_MIN_HZ   2500000000ULL
 
#define AD9208_IP_CLK_MAX_HZ   6000000000ULL
 
#define AD9208_ADC_CLK_MIN_HZ   2500000000ULL
 
#define AD9208_ADC_CLK_MAX_HZ   3100000000ULL
 
#define HW_RESET_PERIOD_US   5000
 
#define SPI_RESET_PERIOD_US   5000
 

Functions

int ad9208_init (ad9208_handle_t *h)
 Initialize AD9208 Device This API must be called first before any other API calls. It performs internal API initialization of the memory and API states. If AD9208 handle member hw_open is not NULL it shall call the function to which it points. This feature may be used to get and initialize the hardware resources required by the API and the AD9208 devices. For example GPIO, SPI etc. More...
 
int ad9208_deinit (ad9208_handle_t *h)
 De-initialize the AD9208 Device. More...
 
int ad9208_get_chip_id (ad9208_handle_t *h, adi_chip_id_t *chip_id)
 Get Chip Identification Data. More...
 
int ad9208_reset (ad9208_handle_t *h, uint8_t hw_reset)
 Reset the AD9208. More...
 
int ad9208_adc_set_channel_select (ad9208_handle_t *h, uint8_t ch)
 Set AD9208 ADC Channel Select. More...
 
int ad9208_adc_get_channel_select (ad9208_handle_t *h, uint8_t *ch)
 Get AD9208 ADC Channel Select. More...
 
int ad9208_set_pdn_pin_mode (ad9208_handle_t *h, uint8_t pin_enable, ad9208_pdn_mode_t pin_mode)
 Sets the operation of the Power Down pin the AD9208. More...
 
int ad9208_adc_set_ch_pdn_mode (ad9208_handle_t *h, ad9208_pdn_mode_t mode)
 Set ADC Channel Power Down Mode. More...
 
int ad9208_set_input_clk_cfg (ad9208_handle_t *h, uint64_t clk_freq_hz, uint8_t div)
 Set AD9208 Input Sample Clock Configuration. More...
 
int ad9208_get_adc_clk_freq (ad9208_handle_t *h, uint64_t *adc_clk_freq_hz)
 Get AD9208 ADC Sampling Clock (Fs) value. More...
 
int ad9208_set_input_clk_duty_cycle_stabilizer (ad9208_handle_t *h, uint8_t en)
 Set AD9208 Input Sample Clock Duty Cycle Enablers. More...
 
int ad9208_get_revision (ad9208_handle_t *h, uint8_t *rev_major, uint8_t *rev_minor, uint8_t *rev_rc)
 Get API Revision Data. More...
 

Detailed Description

Contains AD9208 APIs for ADC Chip Level Configuration and Control.

Release 1.0.x

Copyright(c) 2017 Analog Devices, Inc. All Rights Reserved. This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.

Macro Definition Documentation

◆ AD9208_ADC_CLK_MAX_HZ

#define AD9208_ADC_CLK_MAX_HZ   3100000000ULL

◆ AD9208_ADC_CLK_MIN_HZ

#define AD9208_ADC_CLK_MIN_HZ   2500000000ULL

◆ AD9208_IP_CLK_MAX_HZ

#define AD9208_IP_CLK_MAX_HZ   6000000000ULL

◆ AD9208_IP_CLK_MIN_HZ

#define AD9208_IP_CLK_MIN_HZ   2500000000ULL

◆ HW_RESET_PERIOD_US

#define HW_RESET_PERIOD_US   5000

◆ SPI_RESET_PERIOD_US

#define SPI_RESET_PERIOD_US   5000

Function Documentation

◆ ad9208_adc_get_channel_select()

int ad9208_adc_get_channel_select ( ad9208_handle_t h,
uint8_t *  ch 
)

Get AD9208 ADC Channel Select.

Returns the ADC Channels currently Selected

Parameters
hPointer to the AD9208 device reference handle.
*chA pointer to a Bit wise representation of ADC Channels that are currently active ADC channels are enumerated by ad9208_adc_ch_t For example: *ch = AD9208_ADC_CH_NONE ....No Channel selected *ch = AD9208_ADC_CH_A | AD9208_ADC_CH_B ... Channel A and Channel B Select
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_adc_set_ch_pdn_mode()

int ad9208_adc_set_ch_pdn_mode ( ad9208_handle_t h,
ad9208_pdn_mode_t  mode 
)

Set ADC Channel Power Down Mode.

Sets the Powerdown mode of the AD9208 Channels. The AD9208 has 3 powerdown settings PowerUp/Normal Operation, StandBy Mode, Powerdown Mode This API may be used to set the desired powerdown mode via software. Note 1: The AD9208 also features a Hardware CTRL PIN that may be configured as a global Power down Pin. Note 2: This API should be used in conjunction with ad9208_adc_set_channel_select To set the target channel.

Parameters
hPointer to the AD9208 device reference handle.
modeDesired Powerdown mode
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_adc_set_channel_select()

int ad9208_adc_set_channel_select ( ad9208_handle_t h,
uint8_t  ch 
)

Set AD9208 ADC Channel Select.

Selects the ADC Channels to be active for configuration. Once an ADC Channel is selected to be active subsequent API calls related to ADC Channel configuration shall be applied to that API

Parameters
hPointer to the AD9208 device reference handle.
chBit wise representation of ADC Channels to be made active ADC channels are enumerated by ad9208_adc_ch_t For example ch = AD9208_ADC_CH_NONE ....No Channel selected ch = AD9208_ADC_CH_A | AD9208_ADC_CH_B ... Channel A and Channel B Select
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_deinit()

int ad9208_deinit ( ad9208_handle_t h)

De-initialize the AD9208 Device.

This API must be called last. No other API should be called after this call. It performs internal API de-initialization of the memory and API states. If AD9208 handle member hw_close, is not NULL it shall call the function to which it points. This feature may be used to de-initialize and release any hardware resources required by the API and the AD9208 Device. For example GPIO, SPI etc

Parameters
hPointer to the AD9208 device reference handle.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_HW_CLOSEHW Close Function Failed

◆ ad9208_get_adc_clk_freq()

int ad9208_get_adc_clk_freq ( ad9208_handle_t h,
uint64_t *  adc_clk_freq_hz 
)

Get AD9208 ADC Sampling Clock (Fs) value.

Parameters
hPointer to the AD9208 device reference handle.
*adc_clk_freq_hzPointer to the a uint64_t variable to store the ADC Clk Frequency
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_get_chip_id()

int ad9208_get_chip_id ( ad9208_handle_t h,
adi_chip_id_t chip_id 
)

Get Chip Identification Data.

read-back Product type, identification and revision data

Parameters
hPointer to the AD9208 device reference handle.
chip_idPointer to a variable of type ad9208_chip_id_t to which the product data read-back from chip shall be stored.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle.
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_get_revision()

int ad9208_get_revision ( ad9208_handle_t h,
uint8_t *  rev_major,
uint8_t *  rev_minor,
uint8_t *  rev_rc 
)

Get API Revision Data.

Parameters
hPointer to the AD9208 device reference handle.
rev_majorPointer to variable to store the Major Revision Number
rev_minorPointer to variable to store the Minor Revision Number
rev_rcPointer to variable to store the RC Revision Number
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_init()

int ad9208_init ( ad9208_handle_t h)

Initialize AD9208 Device This API must be called first before any other API calls. It performs internal API initialization of the memory and API states. If AD9208 handle member hw_open is not NULL it shall call the function to which it points. This feature may be used to get and initialize the hardware resources required by the API and the AD9208 devices. For example GPIO, SPI etc.

Its is recommended to call the Reset API after this API to ensure all spi registers are reset to ADI recommended defaults.

Parameters
hPointer to the AD9208 device reference handle.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_HW_OPENHW Open Function Failed

◆ ad9208_reset()

int ad9208_reset ( ad9208_handle_t h,
uint8_t  hw_reset 
)

Reset the AD9208.

Issues a hard reset or soft reset of the device. Performs a full reset of AD9208 via the hardware pin (hard) or via the spi register (soft). Resetting all SPI registers to default and triggering the required initialization sequence.

Parameters
hPointer to the AD9208 device reference handle.
hw_resetA parameter to indicate if the reset issues is to be via the hardware pin or SPI register. A value of 1 indicates a hardware reset is required. A value of 0 indicates a software reset is required.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter
API_ERROR_RESET_PIN_CTRLHW Reset Pin Function Failed

◆ ad9208_set_input_clk_cfg()

int ad9208_set_input_clk_cfg ( ad9208_handle_t h,
uint64_t  clk_freq_hz,
uint8_t  div 
)

Set AD9208 Input Sample Clock Configuration.

Value of the ADC Clock shall be Input Sample Clock/Clock Divider setting. Valid range of Input Clock is 2.5 GHz to 6 GHz The ADC sample clock shall be derived from the input clock and the configured divider setting. Fs = clk_freq_hz/div. Valid range of ADC Clock is 2.5 GHz to 3.5 GHz.

Parameters
hPointer to the AD9208 device reference handle.
clk_freq_hzADC CLK applied to AD9208
divThe desired CLK input divider setting. Valid values are 1,2 and 4.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_set_input_clk_duty_cycle_stabilizer()

int ad9208_set_input_clk_duty_cycle_stabilizer ( ad9208_handle_t h,
uint8_t  en 
)

Set AD9208 Input Sample Clock Duty Cycle Enablers.

When its not possible to provide a higher frequency clock, it is recommended to turn on the Dyty Cycle Stabilizers (DCS)

Parameters
hPointer to the AD9208 device reference handle.
enDesired Enable setting for the targeted DCS 0= Disabled 1= Enabled.
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter

◆ ad9208_set_pdn_pin_mode()

int ad9208_set_pdn_pin_mode ( ad9208_handle_t h,
uint8_t  pin_enable,
ad9208_pdn_mode_t  pin_mode 
)

Sets the operation of the Power Down pin the AD9208.

Sets the Operation of the External power down pin of the AD9208. This pin can configured so that it control entering and exiting powerdown or Standby modes based on the signal applied to the pin. It may also be configured to be disabled so that it does not effect the powerdown mode.

Parameters
hPointer to the AD9208 device reference handle.
pin_enablePowerdown pin enable/disable. 1 - Powerdown pin controls powerdown status 0 - Powerdown pin disable. Does not effect powerdown Status.
pin_modePowerdown mode that Powerdown pin status, if enabled, shall control. Valid options are AD9208_STANDBY -Pin status will control AD9208 Standby Status AD9208_POWERDOWN -Pin status will control AD9208 Powerdown Status
Return values
API_ERROR_OKAPI Completed Successfully
API_ERROR_INVALID_HANDLE_PTRInvalid reference handle
API_ERROR_INVALID_XFER_PTRSPI Access Failed
API_ERROR_SPI_XFERSPI XFER Function Failed
API_ERROR_INVALID_PARAMInvalid Parameter