I have been struggling with an issue now for some time and I have not been able to figure out what I need to do to get this to work properly.
I am using the AD1933 along with an Atmel 32bit microcontroller (3.3V I/O). I send data to the AD1933 over the SPI control port, but I do not ever see a response on the MISO line, and I don't know if the DAC is actually accepting any of the data that I am sending to it.
I am setting CLATCH low, and then the tx data is valid on the rising edge of CCLK. CLATCH has a 10k pullup resistor connected to it. The RST has a 10k pulldown resistor attached, it is driven high after a delay of 1s after the MCU is configured. The CCLK is operating at 705.6kHz and XI is driven by the MCU at 256x44,100kHz (11.289MHz)
I am trying to write to register 1 (PLL & Clock Control 1), and then read back the data after 10ms delay. MISO (not shown in my captures) seems to remain low. The data I am writing to MOSI is 0x080198 and then 10ms later 0x090000.
Things I have tried:
1. Change the operating mode of the SPI (clock polarity and edge).
2. Swap the DAC for another in case the chip was bad.
3. Change frequency of CCLK to different values
4. Pullups/pulldowns on MISO, also disconnect MISO from the MCU and allow it to float.
5. Try writing to a different register, and different data values on MOSI.
Here are images from my scope, please excuse my ancient technology
Thanks for any help!!
Gosh, your technology is so ancient! Just kidding! The scope plots are great and you gave me a lot of good information.
I think I know what the problem is. Then I have a couple of suggestions.
1) I think you need to flip the clock polarity. I will attach a screenshot I made a little while back where I ran into the same issue.
2) You need to wait a little while before trying to program the part after coming out of reset. I am not sure of the exact time it takes before it will accept commands but a program I recently wrote waits 330 mS. This was from power up not coming out of reset but it is something to write into your code now and once it is working you can try to dial it back if you want a faster bootup time.
3) Make sure you have a pull-up resistor on the CLATCH line. From your explanation I am certain this is not the issue but it will prevent issues in the future. You also want to make sure there are no long interrupts during your SPI writes where the CLATCH will be low and stay there for around 5mS. If the CLATCH, CCLK, and MOSI all stay low for just over 5 mS (at your sample rate) then the part will enter standalone mode and you will not have any control over the part until powerdown.
Traces are from top to bottom: CLATCH, CCLK, CDATAin (MOSI) The green trace is noise... it was unused.
Thank you so much for your reply!! I added the delay as you suggested as well as switched the clock polarity but these seemed to have no effect. Your third point got me to re-check the pull-up resistor on the CLATCH signal where I found some issues.
For some reason, the 10k pullup resistor was only pulling the pin up to just under 2V. This must have been an "unknown" state for the DAC since Vhi is 2V, Vlo is 0.8V. I swapped the pullup for a 1k and was able to pull the pin up just above 2V. This seems to allow things to function and I now get a response on MISO.
I am looking into what was causing the pin to be pulled down... the pullup resistor should have pulled the pin nearly all the way to 3.3V. The issue appears to be with the microcontroller pin (I'm using the AT32UC3A3256S just for anyone else who might be interested). When I lift the signal from the microcontroller, the pin is pulled all the way to 3.3V as it should be. Once the pin is configured for SPI, it is able to drive to 3.3 and 0V with no problem, but for some reason it is pulling down when it is unconfigured.
Thanks Bill for the updates and the tests.
We normally have a weak pullup like a 10K on the CLATCH line so you are right to check the microcontroller.
It is strange that it would default to a state where it is driving and not an input or tri-state. I am not familiar with that controller so I cannot offer any advice.
Let me know if you run into any other issues with the codec. Feel free to send me a note directly because I might not be notified of a new post to this thread.