Fast SPI-based serial interface to AD9850 clock generator. Has same interface as (bit-banging based) AD9850 library, but more than x100 faster in frequency update speed. Can sweep 1KHz to 30MHz in 1KHz step in a few seconds.

Embed: (wiki syntax)

« Back to documentation index

AD9850SPI Class Reference

AD9850SPI Class Reference

Fast AD9850 serial interface over SPI. More...

#include <AD9850SPI.h>

Public Member Functions

 AD9850SPI (SPI &spi, PinName fq_ud, PinName reset)
 Create AD9850SPI instance.
void reset_spi ()
 Reset SPI parameter (only) to match with AD9850 requirement.
void reset ()
 Reset device and enable serial mode.
void setFrequency (int freq, int powerdown=0, int phase=0)
 Set frequency.

Detailed Description

Fast AD9850 serial interface over SPI.

Definition at line 7 of file AD9850SPI.h.


Constructor & Destructor Documentation

AD9850SPI ( SPI &  spi,
PinName  fq_ud,
PinName  reset_pin 
)

Create AD9850SPI instance.

SPI instance should be externally created and passed in, with DATA as MOSI and W_CLK as SCLK. Note that NC can be given for MISO, as AD9850 does not have any output.

Parameters:
spiSPI interface to use
fu_udChip select pin
resetReset pin

Definition at line 32 of file AD9850SPI.cpp.


Member Function Documentation

void reset ( void   )

Reset device and enable serial mode.

Also reconfigures SPI bus parameter for transfer.

Definition at line 73 of file AD9850SPI.cpp.

void reset_spi ( void   )

Reset SPI parameter (only) to match with AD9850 requirement.

This is useful when sharing SPI bus line with multiple chips with different SPI parameter.

Definition at line 46 of file AD9850SPI.cpp.

void setFrequency ( int  freq,
int  powerdown = 0,
int  phase = 0 
)

Set frequency.

Note frequency should be <33% of reference clock when used as a clock generator.

Parameters:
freqFrequency in Hz (maps to W0-W31)
powerdownPower-down bit (maps to W34)
phasePhase in degrees (maps to W35-W39)

Definition at line 117 of file AD9850SPI.cpp.