Post Go back to editing

AD9850 - SPI Interface and IIO Driver for Xilinx Zynq-7020

Category: Software

Hi,

I'm using an AD9850 with a Xilinx Zynq-7020 FPGA SoC.

https://www.analog.com/media/en/technical-documentation/data-sheets/ad9850.pdf

I want to be able to drive this via some form of SPI IP core (i.e. AXI SPI), or possibly the AXI SPI Engine.

https://www.xilinx.com/products/intellectual-property/axi_quadspi.html

https://wiki.analog.com/resources/fpga/peripherals/spi_engine

However, the AD9850 does not use standard SPI:

  • The CS logic is inverted (not a major problem, can invert in hardware).
  • The device requires the LSB to be sent first (not a major problem, can invert in software).
  • The serial input requires a 40-bit word (a major problem as AXI SPI only supports 8, 16, 32).

There is a staging IIO driver available for an old version of Linux, which is designed to work with an SPI peripheral.

https://elixir.bootlin.com/linux/v3.8/source/drivers/staging/iio/frequency/ad9850.c

What would be the best way for me to interface with this device, please? Should I make my own modified SPI IP core, or use the SPI Engine - if so, how do I set this up please?

Many thanks,

Adam

Parents
  • Hi  ,

    I may not be as familiar to your suggested AXI SPI engine. But I may agree with you that AD9850 does not somehow use the standard SPI as this was released many years ago. As for the linux driver you found, I may not be able to support it as well as the original programmers that developed this might not be with ADI right now. 

    For SPI control, 

    Note, the AD9851 has two 40-bit input registers. W_CLK and D7 is used program the first 40 bit register (or buffer) contents and a FQ_UD transfers the contents of the first register the second register where data becomes active.

    Here's the sequence:

    1) Apply power and REF CLK source to pin 9.

    2) Send a master reset pulse. (this places the device in default state and the part is in parallel mode)

    3) Send one W_CLK pulse, then send one FQ_UD (this places the device in serial mode)

    4) Using W-CLK and D7 load 40 zeros first and then send one FQ_UD.

    5) Now using W_CLK and D7 load the next forty bits with your desired FTW setting and then send one FQ_UD. The correct frequency should be at the output.

    For other FTWs repeat step 5 only.

    Note, you must always control the number of W_CLKs else the serial port will get out sequence.

    All the best,

    Jules

Reply
  • Hi  ,

    I may not be as familiar to your suggested AXI SPI engine. But I may agree with you that AD9850 does not somehow use the standard SPI as this was released many years ago. As for the linux driver you found, I may not be able to support it as well as the original programmers that developed this might not be with ADI right now. 

    For SPI control, 

    Note, the AD9851 has two 40-bit input registers. W_CLK and D7 is used program the first 40 bit register (or buffer) contents and a FQ_UD transfers the contents of the first register the second register where data becomes active.

    Here's the sequence:

    1) Apply power and REF CLK source to pin 9.

    2) Send a master reset pulse. (this places the device in default state and the part is in parallel mode)

    3) Send one W_CLK pulse, then send one FQ_UD (this places the device in serial mode)

    4) Using W-CLK and D7 load 40 zeros first and then send one FQ_UD.

    5) Now using W_CLK and D7 load the next forty bits with your desired FTW setting and then send one FQ_UD. The correct frequency should be at the output.

    For other FTWs repeat step 5 only.

    Note, you must always control the number of W_CLKs else the serial port will get out sequence.

    All the best,

    Jules

Children
  • Hi Jules,

    Thanks for the information!

    I have managed to implement an IIO driver to work with Linux on the Zynq SoC, using an AXI SPI IP core peripheral to control the data and clock input lines, and an AXI GPIO IP core peripheral to control the FQ_UPDATE input line.

    The driver works fine when I write a raw value to the IIO device, but the default frequency/phase values that I set during the startup probe do not seem to show on the output of the AD9850 - it just outputs seemingly random frequencies.

    As part of the probe, I load the shift register with zeroes before sending the default data.

    I have also tried to write default data multiple times during the probe, but the output still doesn't seem to change.

    Does there need to be a delay between setting up the shift register and writing the initial data? What does this delay need to be?

    Many thanks,

    Adam