Skip to content

Commit 1bb06d3

Browse files
analogcaybuha
authored andcommitted
drivers: adc: ad9625: Added README for AD9625
Added the readme file for the AD9625 driver. Modified the sphinx drivers_doc.rst file to add the corresponding source. Signed-off-by: Ramos <cayetonallan.ramos@analog.com>
1 parent 6ac2bc2 commit 1bb06d3

File tree

3 files changed

+199
-0
lines changed

3 files changed

+199
-0
lines changed

doc/sphinx/source/drivers/ad9625.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../../../../drivers/adc/ad9625/README.rst

doc/sphinx/source/drivers_doc.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ ANALOG TO DIGITAL CONVERTERS
3434

3535
drivers/pulsar_adc
3636

37+
drivers/ad9625
38+
3739
ADC / DAC
3840
==========
3941
.. toctree::

drivers/adc/ad9625/README.rst

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
AD9625 no-OS Driver
2+
===================
3+
4+
Supported Devices
5+
-----------------
6+
7+
- :adi:`AD9625`
8+
9+
Overview
10+
--------
11+
12+
The AD9625 is a 12-bit monolithic analog-to-digital converter (ADC)
13+
optimized for high-speed applications with sampling rates up to 2.6GSPS.
14+
It supports wide bandwidth analog signals up to the second Nyquist zone,
15+
making it suitable for spectrum analyzers, radar, and
16+
electronic countermeasures. The ADC provides differential
17+
inputs for analog, clock, and synchronous signals, with JESD204B-based
18+
outputs configurable across one to eight lanes. Operating over a
19+
temperature range of -40°C to +85°C, it ensures excellent linearity and
20+
performance in demanding environments.
21+
22+
Applications
23+
-------------
24+
25+
- Spectrum analyzers
26+
- Military communications
27+
- Radar systems
28+
- High performance digital storage oscilloscopes
29+
- Active jamming/anti-jamming
30+
- Electronic surveillance and countermeasures
31+
32+
Operation Modes
33+
----------------
34+
35+
+------------------------+-----------------+-----------+-----------------+
36+
| Mode Name | Description | Config | Typical Use |
37+
| | | Bits | Case |
38+
+------------------------+-----------------+-----------+-----------------+
39+
| AD9625_TEST_OFF | No test mode is | 0x000 | Normal ADC |
40+
| | active | | operation |
41+
| | | | without test |
42+
| | | | patterns |
43+
+------------------------+-----------------+-----------+-----------------+
44+
| AD9625_TEST_MID_SCALE | Mid-scale input | 0x001 | Testing |
45+
| | test pattern | | mid-scale |
46+
| | | | linearity |
47+
+------------------------+-----------------+-----------+-----------------+
48+
| AD9625_TEST_POS_FSCALE | Positive | 0x002 | Testing |
49+
| | full-scale | | positive |
50+
| | input test | | full-scale |
51+
| | pattern | | response |
52+
+------------------------+-----------------+-----------+-----------------+
53+
| AD9625_TEST_NEG_FSCALE | Negative | 0x003 | Testing |
54+
| | full-scale | | negative |
55+
| | input test | | full-scale |
56+
| | pattern | | response |
57+
+------------------------+-----------------+-----------+-----------------+
58+
| AD9625_TEST_CHECKBOARD | Alternating | 0x004 | Testing data |
59+
| | checkerboard | | integrity with |
60+
| | pattern | | alternating |
61+
| | | | pattern |
62+
+------------------------+-----------------+-----------+-----------------+
63+
| AD9625_TEST_PNLONG | Long pattern | 0x005 | Comprehensive |
64+
| | sequence | | long sequence |
65+
| | | | test for |
66+
| | | | pattern |
67+
| | | | integrity |
68+
+------------------------+-----------------+-----------+-----------------+
69+
| AD9625_TEST_ONE2ZERO | Alternating 1 | 0x007 | Testing |
70+
| | to 0 test | | alternating |
71+
| | pattern | | toggle response |
72+
+------------------------+-----------------+-----------+-----------------+
73+
| AD9625_TEST_PATTERN | Custom test | 0x008 | Testing |
74+
| | pattern | | user-defined |
75+
| | | | patterns |
76+
+------------------------+-----------------+-----------+-----------------+
77+
| AD9625_TEST_RAMP | Ramp test | 0x00F | Testing |
78+
| | pattern | | linearity |
79+
| | | | across full |
80+
| | | | range |
81+
+------------------------+-----------------+-----------+-----------------+
82+
83+
Device Configuration
84+
---------------------
85+
86+
Device Setup and Configuration
87+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88+
89+
The ``ad9625_setup`` function initializes and configures the AD9625,
90+
involving memory allocation, SPI initialization, and register
91+
configuration. Verification steps check the chip ID and PLL lock status
92+
to ensure proper ADC configuration.
93+
94+
Resource Management
95+
~~~~~~~~~~~~~~~~~~~
96+
97+
The ``ad9625_remove`` function deallocates resources associated with the
98+
AD9625, removing the SPI descriptor and freeing allocated memory to
99+
ensure proper resource release.
100+
101+
SPI Communication
102+
~~~~~~~~~~~~~~~~~
103+
104+
The ``ad9625_spi_read`` and ``ad9625_spi_write`` functions handle SPI
105+
interactions for the AD9625. The read function constructs a command to
106+
fetch data from a register, while the write function sends a command to
107+
write a byte of data to a register.
108+
109+
Testing and Validation
110+
~~~~~~~~~~~~~~~~~~~~~~
111+
112+
The ``ad9625_test`` function configures the ADC for various operational
113+
tests using a ‘test_mode’ parameter, setting the ADC’s test control
114+
register accordingly. This allows for performance verification under
115+
different conditions, ensuring the ADC operates correctly across various
116+
setups.
117+
118+
Driver Initialization Example
119+
-----------------------------
120+
121+
.. code-block:: C
122+
123+
#include <stdint.h>
124+
#include "no_os_delay.h"
125+
#include "no_os_spi.h"
126+
127+
// Initialization parameters for the AD9625 device
128+
struct ad9625_init_param {
129+
struct no_os_spi_init_param spi_init; // SPI configuration
130+
uint32_t lane_rate_kbps; // Lane rate in kbps
131+
uint32_t test_samples[4]; // Test samples
132+
};
133+
134+
// Device structure for the AD9625
135+
struct ad9625_dev {
136+
struct no_os_spi_desc *spi_desc; // SPI descriptor
137+
};
138+
139+
// Set up the AD9625 device
140+
int32_t ad9625_setup(struct ad9625_dev **device, struct ad9625_init_param init_param) {
141+
struct ad9625_dev *dev;
142+
int32_t ret;
143+
uint8_t chip_id;
144+
uint8_t pll_stat;
145+
146+
// Memory allocation and SPI initialization
147+
dev = (struct ad9625_dev *)no_os_malloc(sizeof(*dev));
148+
ret = no_os_spi_init(&dev->spi_desc, &init_param.spi_init);
149+
if (ret < 0) {
150+
no_os_free(dev);
151+
return ret;
152+
}
153+
154+
// Device register configuration
155+
ad9625_spi_write(dev, AD9625_REG_CHIP_PORT_CONF, 0x00);
156+
ad9625_spi_write(dev, AD9625_REG_OUTPUT_MODE, 0x01);
157+
ad9625_spi_write(dev, AD9625_REG_OUTPUT_ADJUST, 0x10);
158+
ad9625_spi_write(dev, AD9625_REG_JESD204B_LINK_CNTRL_1, 0x14);
159+
ad9625_spi_write(dev, AD9625_REG_TRANSFER, 0x01);
160+
no_os_mdelay(10);
161+
162+
// Check chip ID and PLL status
163+
ad9625_spi_read(dev, AD9625_REG_CHIP_ID, &chip_id);
164+
if (chip_id != AD9625_CHIP_ID) {
165+
printf("%s Error: Invalid CHIP ID (0x%x).\n", __func__, chip_id);
166+
return -1;
167+
}
168+
ad9625_spi_read(dev, AD9625_REG_PLL_STATUS, &pll_stat);
169+
if ((pll_stat & 0x80) != 0x80) {
170+
printf("%s Error: AD9625 PLL is NOT locked (0x%x).\n", __func__, chip_id);
171+
return -1;
172+
}
173+
174+
*device = dev;
175+
return ret;
176+
}
177+
178+
// Main function for AD9625 initialization
179+
int main() {
180+
struct ad9625_dev *ad9625_device;
181+
struct ad9625_init_param init_param = {
182+
.spi_init = {/* SPI initialization parameters */},
183+
.lane_rate_kbps = 20000, // Example lane rate
184+
.test_samples = {0, 1, 2, 3} // Example test samples
185+
};
186+
187+
int32_t status = ad9625_setup(&ad9625_device, init_param);
188+
if (status == 0) {
189+
printf("AD9625 setup successfully.\n");
190+
} else {
191+
printf("AD9625 setup failed with status %d.\n", status);
192+
}
193+
194+
// Further application logic
195+
return 0;
196+
}

0 commit comments

Comments
 (0)