Controlling DDS Ad9954 using MKRzero

This is very much a learning exercise for me, which I would hope to take in stages.

I am trying to program the control registers within the AD9954 board, for a very basic function i.e. to output a 40 MHz sinewave, using the MKRzero - not having much success.

The first stage is to try and program all the registers and read one of them back and display it on the serial monitor.That way I can prove that my method for reading and writing to the DDS is correct.

The latest sketch I have is included in the attachment. I think the part which reads from AD9954 may be at fault as it reads all zeros - this is at the very end of the sketch.

Unfortunately I do not have any diagnostic tools to help me, so the amount of testing I can do is very limited.

I think I may have bitten off more than I can chew !

SCLK5.ino (8.76 KB)

Post a wiring diagram of your setup!

You should use the SPI hardware to communicate with the device and use the CS signal if possible.

The transfered information is of type byte, so you should use that type or uint8_t instead for the command arrays.

You don't need the delay() calls for I/O Update spike.

digitalWrite(ioupdatepin, HIGH);
digitalWrite(ioupdatepin, LOW);

That does the job of a spike too. It needs to be high for a few nanoseconds only.

Thanks for getting back.

Please find attached how I have interconnected the Arduino and AD9954.

Originally I had connected the CS pin to permanent ground. I have been this will not work and I need to toggle it. Therefore I have connected CS to A5 and will add a few lines to the sketch.

I intend to make other changes you have suggested, but thought I would send the wiring diagram in the meantime.

Regards, Derek

IOMKRzeroAD9954DDS.pdf (419 KB)

I have updated the last pdf attachment.

IOMKRzeroAD9954DDS.pdf (418 KB)

"AD9954 DDS BOARD" means you use a breakout board and not the chip directly. Post schematics of that board (the vendor should provide that!).

I purchased the board from China off ebay - no schematics.

The attachments include a photo of the i/o connector block and a ss describing each pin as some of them are a bit hard to read in the photo.

I have made major adjustments to the sketch which should make it easier to read.

I am still convinced the problem lies with reading the values back from the Ad9954.

Still getting all zeros.

SCLK6.ino (3.79 KB)

AD9954IO.pdf (102 KB)

I purchased the board from China off ebay - no schematics.

So you have to reverse engineer that board. Without the schematics you probably won't get that thing to connect correctly to your Arduino. Never, never buy hardware without the needed documentation! For a breakout board schematics are needed to use them (or at least a detailed description of every pin on the connector).

Some questions you have to answer by reverse engineering the board:

  • do all signals have level converters?
  • does CS high put SDO into tri-state?
  • where is UPD connected to?

If you cannot find an answer to these questions your hardware is worthless because you cannot use it, unfortunately.