Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Rasp Pi pico and AD9834 DDS chip

Status
Not open for further replies.
I am experimenting with a AD9834 freq generator chip and a Raspberry pi pico chip, communicating via SPI. I can get a waveform to show on my scope but it doesnt seem
to correspond correctly with my calculated freq word. I am using the AD9834 with 75 mhz clock. So my freq calcs are: 7 mhz desired, so 7e6 * 2^28/75e6=0x17E4B18. When I chop the result up into two 14 bit values, and OR the freq reg 0 bits (01) on the end, I end up with MSB=0x45F9 and LSB=0x4b18. I load this into my micropython program, run the program, load the LSB first into the AD9834, then MSB it starts OK but my actual freq is 13 mHz. I get a nice sine wave, 200 mV peak to peak, but wrong freq. I am pulling my hair out trying to figure this out, I checked and rechecked my LSB MSB calculation several times , I know those are right. Its almost like the MCLK is not really running at 75 mHZ, but my scope confirmed it was (74.9ish mhz). ANyone run into this?
 

Yes, as I already said, with parasitic capacitances, etc. you'll definitely see some impact on amplitude vs. frequency. This is why layout is critical. You don't say anything about your layout.
 

There is no layout yet, I'm still BreadBoarding it.
 

(Note: I've not used the Pico but I have other RPIs and many other SPI modules)
Re how SPI works, the normal situation is for the clock to be active only for the duration of the exchange - 8 (or 16 or whatever) bits. When you drive the '\CS\' line low, that is the signal to the slave to start looking for clock transitions - this stops problems with stray transitions and makes sure that everything is synchronised between the master and the slave.
You need to read the data sheet for the slave as to how it handles multi-value transfers. With some it will buffer/process the entire set of values until the \CS\ signal goes high which is the signal to action the message. Others want the \CS\ bit to go high after each exchange to latch the value.
Either way, there should be no need for any delays after the last bit has been exchanged - unless the slave data sheet explicitly says this is a requirement (and most will have this delay in nS to make sure the last clock transition is complete before the \CS\ transition).
Therefore you should be able to:
- lower \CS\
- exchange the values (waiting for the exchange(s) to complete)
- raise \CS\
in consecutive instructions.
(There is one exceptional mode where the clock is continuous and the \CS\ signal is used as a framing trigger but that does not seem to be the case here.)
Susan
 

There is no layout yet, I'm still BreadBoarding it.
breadboard? Like, how? One of those white plastic things? Whatever you've got, it's a layout. And I'd bet a week's pay that your layout or breadboard, or whatever you want to call your physical implementation, is the cause of your frequency response.
 

The actual AD9834 is on a small PCB that I purchased and has the 75 Mhz crystal, bypass caps, low pass output filter and other circuitry on it. Signals for SPI and power are brought out to a 5 pin header. My uController, a pi pico, is also a small self contained PCB with regulator, 125Mhz clock and bypass caps and all sigs brought out to a 40 pin header. And an OLED display that connects to the pico I2C port. So yes, they are all plugged into a plastic breadboard and jumpers go between the two. I know its not ideal, but I am starting something from the concept stage, so I just need to test out possible components before I do a board layout. I'm also going to test all of this with a PIC18F25 micro next before I decide which uC to go with, then I'll do a board design. I started with the pico because I like Python, not possible on the PIC18, C or assembler only.
--- Updated ---

Thanks Aussie Susan, I think I've got the SPI sorted out, I'm just trying to sort out a few problems with the slave devices output. Barry had suggested eliminating the delays I had in there, and I think that was correct.
 
Last edited:

So, what are the characteristics of your output filter? It might be doing exactly what it's supposed to.
--- Updated ---

It should be a simple matter to simulate it.
 

I don’t know, the filter is on the tiny ad9834 board, I don’t have schematics with it, (a problem with getting any kind of of docs with these Chinese eBay boards), I can only see a couple of SMT inductors in series and some 0603 size caps on the board, forming some kind of LC filter.
 

Thanks for that, your condescension is appreciated. Many of us have attempted to prototype ideas and concepts in less then ideal circumstances, like by tying a chip to another with wires, jumpers, hacking some code together or whatever. It seems like you are a pretty smart person, but you don’t have to reply to my posts anymore.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top