Page 1 of 5

AD9833

Posted: Wed Jun 07, 2023 1:12 am
by Vatel20
There is someone to help me with the commands SPI of AD9833.
I can pay. thanks

Re: AD9833

Posted: Wed Jun 07, 2023 9:38 am
by mnfisher
It looks easy to use - see https://gist.github.com/m5mat/d102c36f2 ... 5dbc4c2372 for some C code.

The datasheet I found doesn't seem to contain a detailed description of the control register however - more googling needed.

If you'd like to send me a couple of the chips I'll do it.

Martin

Re: AD9833

Posted: Wed Jun 07, 2023 9:51 am
by mnfisher

Re: AD9833

Posted: Wed Jun 07, 2023 12:17 pm
by chipfryer27
Hi

Following on from Martin, this link is to Analogue Devices

https://www.analog.com/en/products/ad98 ... t-overview

If you scroll down you will see many documents relating to the device including SPI and Programming.

Regards

Re: AD9833

Posted: Thu Jun 08, 2023 7:51 pm
by Vatel20
What am I doing wrong ?

Re: AD9833

Posted: Thu Jun 08, 2023 8:46 pm
by mnfisher
One issue - in SPISendData - you create a block of 10 bytes, but only send 4.
SendByteArray(4, data) - should this be SendByteArray(10, data)

Martin

Re: AD9833

Posted: Fri Jun 09, 2023 12:13 am
by Vatel20
I fixed it but it still doesn't output.
thank you

Re: AD9833

Posted: Fri Jun 09, 2023 7:21 pm
by mnfisher
The device needs a brief delay after pulling fsync low - about 10microsecs

Looking at the sample code (link above) - it looks as though 32 bit data must be sent 16bits at a time (with fsync toggled between words)

Martin

Re: AD9833

Posted: Fri Jun 09, 2023 7:46 pm
by mnfisher
I've nothing to test with - but try something like:
AD833Test.fcfx
(18.47 KiB) Downloaded 140 times
Note that I've used pin 10 as FSYNC (also known as CS or ChipSelect) - on the Arduino this must be set as an output for SPI to work correctly. I've set the pin high at the start of the chart - so if you used a different pin as CS - it should still work. If you use something other than Arduino though - remove this line.

Note this is a quick conversion of the code on github - I feel the frequency calculation could be tidied up (and may overflow as is) - possibly multiply by a smaller number and reduce ref by a suitable factor.


Martin

Re: AD9833

Posted: Fri Jun 09, 2023 8:24 pm
by chipfryer27
Hi

I think the code is from the Application Note document

AN-1070.pdf
(127.02 KiB) Downloaded 155 times

I wasn't aware of the Arduino "quirk" re pin 10. Good to know :)

Regards